6 Replies Latest reply on Mar 7, 2015 11:15 AM by philmodjunk

    'record being modified in another layout'



      'record being modified in another layout'


      I like to use 'popup' windows to gather options for creating reports etc. When the user 'closes' the window everything is ok. But when they just click into the background layout, the window remains open. Occasionally they'll get the 'record being modified.....' message which I'm guessing is caused by the cursor being left in a field on the popup that the solution is trying to modify for the report.

      When the popup is left by just clicking into the background layout, is there a way to cause the popup to close (there doesn't seem to a script trigger for that). Or is there some way to lock onto the 'popup' so the only way to leave is by a 'proper' close/exit (e.g., a button)?  Ideally it would be something like the 'show message' script step popup that forces a response before the script can proceed.

        • 1. Re: 'record being modified in another layout'

          If the record is "open" for editing in one window, the record cannot opened for editing in another window. Nor can it be edited by another user if the file is hosted over a network to allow multiple users at the same time.

          If you are using FileMaker 12 or newer, there are options that are part of the New Window script step that allow you to specify that the new window is "modal". this will cause all other windows to be unresponsive to the user for as long as the newly opened window is open.

          If you are using an older version, let me know as I used to use a paused script inside an infinite loop to simulate "modal" behavior in a newly opened window.

          In some cases, if you are using FileMaker 13, you might consider using a popover instead of a new window. The popover will close automatically (and doing so strips a script trigger) when the user clicks into the "background" of what is now one and the same window plus, there is no record locking issue as you still have just one window open.

          • 2. Re: 'record being modified in another layout'

            I'm on FM13. This sounds like exactly what I need!

            (and it is).


            On occasion, I 'chain' these 'popups' - the 'popup' opens a new window that I want also to be 'modal'. But when attempting to open the new window from a 'modal' window, I get an 'error 3' - the command is unavailable. I would like the first popup to remain open when the 2nd popup is opened.

            (I suppose I could close the first before opening the 2nd, or close the first, reopen it in 'regular' mode and then open the 2nd popup. Then close the 1st and reopen in modal after closing the 2nd).

            Is there an easier way to 'chain' the 'new window' steps so that only the latest window opened is 'modal'?

            • 3. Re: 'record being modified in another layout'

              Not if you use the advanced window options to make each window modal. I've considered the "old school" approach of using a paused script, but that may be a solution worse than the cure...

              • 4. Re: 'record being modified in another layout'

                Hmm, then again, maybe not. Here's how to simulate "modal" windows with a paused script:

                   Pause/resume [indefinitely]
                End Loop

                You make this the last part of the script that opens the new window.

                A button in Window A could still perform a script to open Window B and have yet another instance of this loop. A "close", "Submit" or "OK" button on the layout set to close the window can also use Halt Script  as its last step to halt all such paused scripts. If this is intended to return focus to the previous window then we have a problem as all windows will now not be modal, but if this is intended to close the entire "chain", then it could be made to work.

                I'm actually wondering if another bit of layout trickery would be worth all the added effort:

                Make a duplicate of each layout involved, but with the entire layout covered by a large invisible button. The new window script would first change the current window's layout to this duplicate before opening the new window and setting a global variable to the name of the new window. The invisible button then uses the variable with the select window step to return focus to the last window opened.

                I see potential complications with that--you might have to set up a global field or variable that tracks every window currently open and using FileMaker advanced to set up custom menus that perform a script when the user clicks a control to close the window would simplify things a lot, but this might be necessary if you can't figure out a simpler approach...

                • 5. Re: 'record being modified in another layout'

                  As you mentioned, the 'pause' loop makes everything 'non-modal' so that isn't a good solution. The duplicated layouts could work, but I'm sure I would end up making a change to 1, and forgetting to update the duplicate sooner or later.

                  What seems to work ok when opening the 2nd window in the chain (3 windows total open) is the following:

                  close 1st popup window (currently modal). reopen 1st popup as 'document window'. open the 2nd popup as 'modal'.

                  Reverse the process to close the 2nd popup:

                  close 2nd popup. close 1st popup. Reopen 1st popup as 'modal'.

                  This solution requires duplicating the 'open window' script (or passing a parameter to a single script to decide whether to open modal or not). I'll have a much better chance of keeping the script(s) in synch!

                  Thanks for the help.

                  • 6. Re: 'record being modified in another layout'

                    On the contrary, the pause loop locks the user out of all windows but the window where you paused the script. And you are correct, the biggest headache to duplicate layouts is keep them "in Synch" though doing so isn't as bad as you might think as you can delete all layout objects from the duplicate layout and then copy paste everything over from the now updated original.