5 Replies Latest reply on Jun 17, 2014 9:15 AM by philmodjunk

    Window focus and context when scripting sequence with multiple windows

    JeroenAarts

      Summary

      Window focus and context when scripting sequence with multiple windows

      Product

      FileMaker Pro

      Version

      13

      Operating system version

      Windows 7

      Description of the issue

      Create a script - or sequence of scripts - that opens more than 1 offscreen window (height = -2000pt for example). If you run the  script and click (multiple times) on the background window, focus is shifted and the script is run in an incorrect context. It also appears that windows are mixed up because after closing all windows, the background window has "disappeared". It does not matter if User Abort is On or Off.

      Steps to reproduce the problem

      Create a script - or sequence of scripts - that open more than 1 offscreen window (height = -2000pt). For example, create a new window, Go To Layout B create a record, create a new offscreen window, Go To Layout C and create a new record. If you run the parent script, if a user clicks (multiple times) on the background window focus is shifted and the script is run in an incorrect context. It also appears that windows are mixed up because after closing all windows, the background window has "disappeared"

      Expected result

      Each window should maintain its focus properly and the script should keep its expected context in all circumstances

      Actual result

      Script is executed against wrong context (Layout and TO) and is a real hazard.

      Exact text of any error message(s) that appear

      Depends on what is executing. May be "Object is not part of a related table" if trying to perform a Set Field script step

      Configuration information

      -

      Workaround

      - Do no use offscreen windows. But they are handy to prevent window flickering
      - Go To Original Layout before closing additional windows

        • 1. Re: Window focus and context when scripting sequence with multiple windows
          TSGal

               Jeroen Aarts:

               Thank you for your post.

               Using FileMaker Pro  13.0v3 under Windows 7, I am unable to replicate the issue.  Here are the steps I took:

               1. I created a file, Test.fmp12, with three tables - First, Second, and Third.

               2. The three layouts are named "First", "Second" and "Third", respectively.

               3. I created the script "Test Windows" with the following steps:

               # check to make sure "Window 2" is not already open
               If [ PatternCount ( WindowNames ; "Window 2" ) = 0 ]
                  New Window [ Name: "Window 2" ; Style: Document ]
               Else
                  Select Window [ Name: "Window 2" ; Current file ]
               End If
               #
               # go to appropriate layout, add record, and commit
               Go To Layout  [ "Second" (Second) ]
               New Record/Request
               Commit Record/Request
               #
               # check to see if "Window 3" is not already open
               If [ PatternCount ( WindowNames ; "Window 3" ) = 0 ]
                  New Window [ Name: "Window 3" ; Style: Document ]
               Else
                  Select Window [ Name: "Window 3" ; Current file ]
               End If
               #
               # go to appropriate layout, add record, and commit
               Go To Layout  [ "Third" (Third) ]
               New Record/Request
               Commit Record/Request

               -----

               Granted, there isn't a lot of time to switch between windows, plus I'm leaving the Windows open after execution.  Perhaps you can provide more information on what is being updated and what additional instructions you are executing so I can replicate the issue.

               TSGal
               FileMaker, Inc.

          • 2. Re: Window focus and context when scripting sequence with multiple windows
            JeroenAarts

                 Thanks for your quick answer. However, using FileMaker Pro Advanced 13v3 on Windows 7 Professional (And FMP13v3 on Windows 2008 R2 for our customer's client for that matter) the issue is easy to reproduce.

                 I create 3 tables: A, B and C. I have 3 TO's and layouts based on them respectively. My script opens an offscreen window (height: -5000pt) starts a loop to create record on Layout B, and in every iteration it opens on its turn a new offscreen window, navigates to Layout C, creates a new record there and then closes that window.

                 I added a screenshot of the demo script.

            • 3. Re: Window focus and context when scripting sequence with multiple windows
              TSGal

                   Jensen Aarts:

                   Thank you for the additional information.

                   Although I don't know what was in your "TEST_LOG" script, I just skipped that step and replaced C::Name with the $i, like what was done in B::Name.  With that said, I was able to replicate the issue with your script under Windows 7.  If users are going to try and select another window in the middle of the script, then make the Windows Dialog windows so they cannot select another window.  After making those changes and setting $MAX_RECORDS to 1000, I was unable to replicate the issue.  See the changes below in my script.

                   TSGal
                   FileMaker, Inc.

              • 4. Re: Window focus and context when scripting sequence with multiple windows
                JeroenAarts

                     Thank you for your feedback. Making the windows Dialog windows resolves the issue on Windows. On Mac there is no need to make the windows Dialog windows, the issue is Windows only.

                • 5. Re: Window focus and context when scripting sequence with multiple windows
                  philmodjunk

                       Regardless of whether FileMaker Inc. considers this a bug or a behavior difference, an entry in the Known Bugs List has been linked to this Issue Report. Any Comments/Questions/Suggested Corrections should be posted here or in a new thread. Please do not post such comments to the Known Bugs List thread.