5 Replies Latest reply on Sep 30, 2013 9:49 AM by disabled_ntaylor

    OnLayoutExit runs if two windows have same name

    sq

      Summary

      OnLayoutExit runs if two windows have same name

      Product

      FileMaker Pro

      Version

      12.04

      Operating system version

      10.8.4

      Description of the issue

      A layout is opened by a script with using a new window.
      The layout has OnLayoutEnter and OnLayoutExit triggers

      Both triggered scripts do some window animation.
      When the window opens the first time it works fine.
      If the window is left open and the button is clicked and the window opens again with the same name, the new window runs the OnLayoutExit trigger, but the window does not close (the on exit animation runs which looks strange, then the OnLayoutEnter runs.
      renaming the window so the next time the button is clicked confirms that it is the duplicate window name makes the OnLayoutExit run on opening window.

      Steps to reproduce the problem

      have a layout with a button to open a second layout with a new window with a name.
      have the second layout have OnLayoutEnter and OnLayoutExit triggers
      click the button twice and use script debug to see that the OnLayoutExit trigger runs on opening the second time

      Expected result

      OnLayoutExit trigger should only run when closing a window not when opening a window with the same name as another window.

      Actual result

      OnLayoutExit trigger runs on opening and before OnLayoutEnter for a window with the same name as another window.

      Exact text of any error message(s) that appear

      no error

      Workaround

      none

        • 1. Re: OnLayoutExit runs if two windows have same name

          sq:

               Thank you for the post.

                

               What is the script or process used to open the new window? Does the new window open to the same layout as the first window or a different layout? 

                

               The expected result, according to KB7465 on Understanding and using Script Triggers states: 

                

               "OnLayoutExit: Triggers a script to run before a layout is exited."

                

               A window and a layout are two separate entities within FileMaker. Window #1 and window #2 could both display Layout A. Or window #1 could display Layout A while window #2 displays Layout B. Multiple open windows can show the same layout or two open windows can show two different layouts.

                

               Layout A is displayed in window #1. If I do not wish for the OnLayoutExit script to trigger, then the following script will open window #2 to Layout A:

                

               New Window [Style: Document]

                

               However, the OnLayoutExit script will trigger if the "Go to Layout" script step were used to display Layout B in window #2 with this script:

                

               New Window [Style: Document]

               Go to Layout [Layout B]

                

               The OnLayoutExit script will trigger in the above example because FileMaker exited Layout A to Go to Layout B. The name of the window doesn't matter at all, but whether the layout with the script trigger was exited.

                

               Please let me know if any of the above needs additional clarification.

                

               TSFalcon

               FileMaker, Inc.

          • 2. Re: OnLayoutExit runs if two windows have same name
            sq

                 A script opens a new window and then goes to a layout.

                 yes it is like,

                  

                 New Window [Style: Document]

                 Go to Layout [Layout B]

                  

                 The Layout A onlayoutexit is being run on Layout B in the new window.  This seems very odd.

                 The onlayoutexit from Layout A only runs, after the second new window is opened for Layout B 

                 If I disable the onlayoutexit on Layout A, then Layout B does not have the issue when opening the second window of Layout B.

                  

                 Shouldn't each layouts trigger only occur on is own layout and window?  Why is layout A trigger running on layout B only when the second window for Layout B is opened?

                  

            • 3. Re: OnLayoutExit runs if two windows have same name

              sq:

                   Thank you for the reply.

                    

                   The "New Window" script step will open a new window from the current layout (Layout A), then the Go to Layout script step will exit Layout A to enter Layout B.

                    

                   Since this is a FileMaker script, the end user only sees the new window showing Layout B; however, the process that occurs follows:

                    

                   New Window [Style: Document]

                   1. New window opens

                   2. Enters Layout A (OnLayoutEnter scripts trigger)

                   Go to Layout [Layout B]

                   3. Exits Layout A (OnLayoutExit scripts trigger)

                   4. Enters Layout B (OnLayoutEnter scripts trigger)

                    

                   Layout A's OnLayoutExit script will trigger in the new window prior to entering Layout B.

                    

                   TSFalcon

                   FileMaker, Inc.

              • 4. Re: OnLayoutExit runs if two windows have same name
                sq

                     if the exit trigger is running on layout A, then why is it using the parameters from Layout B?

                     and why only on the second run (ie Two Windows of Layout B open) of opening layout B?

                     parameters for Layout A is set to 0, do nothing.  parameters for Layout B is do something (when the window is closed)

                     taking your example, this is what is happening instead:

                      

                     New Window [Style: Document]

                     1. New window opens

                     2. Enters Layout A (OnLayoutEnter scripts trigger)

                     Go to Layout [Layout B]

                     3. Exits Layout A (OnLayoutExit scripts trigger) but using the parameters from Layout B (why?)

                     4. Enters Layout B   (OnLayoutEnter scripts trigger)

                • 5. Re: OnLayoutExit runs if two windows have same name

                  sq:

                       Thank you for the reply.

                        

                       To attempt to replicate, I created a new file:

                        

                       1. Two Layouts: 

                        

                       Layout A: 

                       OnLayoutEnter Script Trigger: "Enter Trigger Script"; Parameter: "A"

                       OnLayoutExit Script Trigger: "Exit Trigger Script"; Parameter: "A"

                       Button: Perform Script "New Window" (no optional script parameter)

                        

                       Layout B:

                       OnLayoutEnter Script Trigger: "Enter Trigger Script"; Parameter: "B"

                       OnLayoutExit Script Trigger: "Exit Trigger"; Parameter: "B"

                       Text Field

                        

                       2. Three Scripts: 

                        

                       Enter Trigger Script:

                       Show Custom Dialog [Get ( ScriptParameter ) & "Enter"

                        

                       Exit Script Trigger:

                       Show Custom Dialog [Get ( ScriptParameter ) & "Exit"

                        

                       New Window Script (Button on Layout A):

                       New Window [Style: Document]

                       Go to ["Layout B"]

                        

                       Clicking the button on Layout A performs the script "New Window" without a parameter specified:

                        

                       1. In the background, New Window shows "Layout A"

                       2. In the foreground, Custom Dialog window displays "Aenter"

                       3. Click "OK"

                       4. Custom Dialog window displays "Aexit"

                       5. Click "OK"

                       6. In the background, New Window shows "Layout B"

                       7. In the foreground, Custom Dialog window displays "Benter"

                       8. Click "OK"

                        

                       End Result: "Layout A" open in the background and "Layout B" open in the foreground.

                        

                       In your file, how is the parameter passed from Layout A to Layout B? Perhaps, I am missing a step to replicate?

                        

                       TSFalcon

                       FileMaker, Inc.