Triggers a script to run 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.
You can use the Exit Script script step within the triggered script to return True or False.
Originated in 
FileMaker Pro 12.0
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.
Related topics 
Setting up script triggers
Setting script triggers for layouts
Setting script triggers for objects