Database Reference
In-Depth Information
Figure 11-24. The
OnPanelSwitch
trigger fires when any tab is clicked, so scripts should use
Get
(Trigger-TargetPanel
) to find out which tab panel is the target.
Get(Trigger-TargetPanel)
returns both the tab number and the title of the tab, so it is nested inside the
GetValue()
function,
which lets you select the return value you need. A companion function,
Get (TriggerCur-
rentPanel)
lets you know which tab was active when the user clicked the new target.
Test this out for yourself without writing a script. This chapter's finished sample file has a
layout called “Customers [with OnPanelSwitch trigger].” Its Tab Control uses the
OnPanelSwitch
trigger to call the script and stop unauthorized users from viewing the In-
voice tab. A third tab is completely open for business, though.
NOTE
Scripts attached to
OnPanelSwitch
triggers must always have at least one true condition. In the case
in
Figure 11-24
,
one user (“sprosser”) can click the Invoices tab. Until you provide one true condi-
tion, no one can click your now-hidden tab panel.