1 2 Previous Next 16 Replies Latest reply on Apr 6, 2017 6:26 AM by philmodjunk

    Open a new window in a diferent layout

    c.wagner1

      Title

      Open a new window in a diferent layout

      Post

      i have a layout that has several intensive on layout load and on record load script triggers that have to run to set it up.  They may take a second or so to complete. This is not a big deal because you do not need to jump around from layout to layout in my file.  There are several times that I do open an additional window as a dialog window to preform various functions. The problem is the new window script step will always open to the current layout and all the associated script triggers have to fire before I can switch to the correct layout for what ever need at the time.  This causes some the file to feel sluggish in some cases. The only thing I can think of to eliminate this issue is to open an off screen window to a blank layout on start up and switch to it before opening dialog windows I may need.  While this should work, there seems to be to many ways it could go wrong.  Any ideas?

        • 1. Re: Open a new window in a diferent layout
          philmodjunk

          It is often necessary to disable script trigger performed scripts before changing layouts or records. This can be done as follows:

          a) in every trigger controlled script that might be performed by your scripted action, enclose the entire script in an IF block similar to this:

          If [ Not $$TriggersOff ]
             Put rest of script here
          End IF

          Then, in your script that will trip these script triggers, set up your script like this:

          Set variable [$$TriggersOff ; value: True ]
             Go to Layout
          Set Variable [$$TriggersOff ; value: False ] ----> this step can be put anywhere after the "triggering" step so long as it always executes to re-enable trigger controlled scripts whenever the earlier Set variable step disables it..

          1 of 1 people found this helpful
          • 2. Re: Open a new window in a diferent layout
            FilmUser

            I feel that it is both presumptuous and foolhardy to follow with Phil's advice with something different, being the FMP rube I am, but here goes:

            Could you, rather than using the New Window menu command (which opens a new window just like the one you are in, and re-fires everything) just create a script -

            the first step: New Window, which then allows you to size and name it, etc,

            then a second step: Go to Layout - of your choice.

            This might avoid the actual opening a second window of the same one you are in. Plus you can size and place the window wherever you want, and rename the new window to something meaningful.

            You can then place a button on the original layout to run the script, then close the second window when finished, with the original layout still there.

            I do this for lots of temporary "side trips" for certain work flows.

            • 3. Re: Open a new window in a diferent layout
              philmodjunk

              Hey we all have to learn by getting in there and trying. wink

              FilmUser, what you describe is what Christopher Wagner is already doing and the new window script step is what is tripping the script triggers and thus producing an undesirable delay. My approach still uses the new window, go to layout script steps, but only after temporarily disabling script triggers by setting a global variable to True.

              • 4. Re: Open a new window in a diferent layout
                FilmUser

                Phil - So, in other words, scripting a new window followed immediately in the script by a layout navigation, doesn't escape the triggers set in the load of the original window, which would fire from the regular menu command of New Window?

                 

                • 5. Re: Open a new window in a diferent layout
                  philmodjunk

                  OnRecordLoad in the NEW window is tripped as the new window will initially have the same layout as the current window. I think OnLayoutEnter on the new window and OnLayoutExit on the old window might also be tripped, but I'd have to check.

                  This is why I have developed the habit of enclosing trigger controlled scripts inside such an If block, all referencing the same global variable. that way I can set this variable to True and disable all triggers until I clear its value.

                  • 6. Re: Open a new window in a diferent layout
                    c.wagner1

                     

                     

                    Phil is right. No matter what when you create a new window all the script triggers fire. OnLayoutEnter and OnRecordLoad. I'm pretty sure OnLayoutExit does not because I don't ever remember seeing it in the script stack in the debugger.

                    My next question Phil, is why enclose all your entire script trigger scripts in an if statement? Wouldn't a 

                    If [$$TriggersOff]

                         Exit script

                    Be just as effective and maybe a little more readable?  Just wondering on this one. 

                    Lastly at what point does server send the client the text of the script. Is this done on connection, layout load, or when called?  Most of my performance hits are over WAN. 

                    One last thing, unrelated, for being a Apple product, the filemaker website and forums sure suck to use from an iPhone or iPad!!

                    • 7. Re: Open a new window in a diferent layout
                      philmodjunk

                      Your 6 = my 1/2 dozen

                      Lastly at what point (but not really the LAST...wink

                      I don't really know being a fellow user.

                      One last thing,

                      Yep and if you check the Feedback section, you'll find that you are not alone in that. I cannot say much being under NDA, but I can confirm that the folks responsible for these forums are not unaware of this issue.

                      • 8. Re: Open a new window in a diferent layout
                        jwsmall

                        You could also use "go to related record(s)" in a new window.  It'd require

                        1. A related table guaranteed to have at least 1 record in it, for any record in the table for your 'original' layout
                        2. A layout for that other table with no 'OnLayoutEnter' script triggers

                        It might be easier to implement this as a solution to the problem

                        • 9. Re: Open a new window in a diferent layout
                          CharlotteLasek

                          Thanks jwsmall ! This worked for me since I'm opening a form based on a global table anyway. Perfect!

                          • 10. Re: Open a new window in a diferent layout
                            philmodjunk

                            Since 2014--when this thread started, I've learned a new trick that also works.

                             

                            Have your script enter find mode, then open the new window and change layouts before entering Browse mode. This would be an option for when GTRR isn't appropriate.

                            1 of 1 people found this helpful
                            • 12. Re: Open a new window in a diferent layout
                              csodemann

                              Ah, but will this not leave the original windows/layout in Find Mode, after switching windows?

                              • 13. Re: Open a new window in a diferent layout
                                philmodjunk

                                Of course!

                                 

                                but the script can put the window back into Browse mode after window and layout "stuff" has been done.

                                • 14. Re: Open a new window in a diferent layout
                                  csodemann

                                  Yes, but I would like the new window to take focus, which involves shifting forth and back?

                                  1 2 Previous Next