Reference > Script triggers reference > OnPanelSwitch
 
OnPanelSwitch
Performs a script when a panel control changes panels. This can happen in a tab control, for example, when a user clicks an inactive tab panel or when a script changes the focus to an object on a different tab panel.
When the script runs
Before the event has been processed.
Modes in which the trigger can be used
Browse and Find modes.
Result
You can use the Exit Script script step within the triggered script to return True or False.
True: The event that triggered the script proceeds.
False: The event that triggered the script is canceled.
Compatibility 
 
Where the script trigger is activated 
Supported 
FileMaker Pro 
Yes 
FileMaker Server 
Yes 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 12.0
Notes
OnPanelSwitch applies to the entire panel control and not to individual panels. To control switching to particular panels, use the Get(TriggerCurrentPanel) and Get(TriggerTargetPanel) functions.
Because this trigger is activated before the panel switch event is processed, the value of the script parameter that OnPanelSwitch passes to your script is determined before the panel is switched. Therefore, if you use the script parameter to pass the returned value of Get(TriggerCurrentPanel) or Get(TriggerTargetPanel) into your script, the value will be zero. To get useful returned values, use these functions only within the script activated by OnPanelSwtich, not in the script parameter.
Related topics 
Setting up script triggers
Setting script triggers for layouts
Setting script triggers for objects