When using the OnLayoutExit script trigger, how do you get the target layout (layout the user is trying to switch to)? So e.g. you can perform a series of actions, or not, based on the target layout?
You will need to script the button being used for navigation in order to capture that information. Simply choosing the destination layout from FileMaker's drop-down list of layouts will not give you the information you seek.
Yeah, that's what I was afraid of... I wish I could remove the layout drop-down without losing the entire status toolbar. As long as it's there, people will use it.
You could remove all the layouts from the drop-down menu. To do so, go the the Manage Layouts menu (on the File menu) and un-check each layout.
Yes, but that would effect the entire DB, not just the layout I want to control exit from.
why not set layout access in security controls?
You could set a global with the OnLayoutExit, then check that same global in the destination layout's OnLayoutEnter script.
Because this isn't a security issue. The user is allowed to, and might reasonably choose to, change layouts. But depending on the targeted layout, certain other actions might (or might not) need to happen.
Yes, that's the best I've been able to come up with. Unfortunately, that involves setting up a *lot* of layouts with OnLayoutEnter, and (worse still) remembering to do so with layouts created in the future.
Let's go to product idea.
Exiting layout don't mean entering another layout always, it may be the reason that there is no target layout. (Or, simply forgot to implement it)
Seems to me that you should be using OnlayoutEnter instead of OnlayoutExit.
All of my user accessible layouts have OnLayoutEnter, OnModeEnter, OnLayoutExt, and OnModeExt scripts attached. Each of the triggers have their own generic script. That trigger script will direct to subscripts if necessary, or may do nothing at all, but they're there if necessary.
It's not hard to do it retroactively (10-15 seconds per layout means an hour of clicking for 150 layouts. I also create new layouts by duplicating a "Template" layout which includes those triggers.
Retrieving data ...