Disabling Tabs with a Triggered Script

Tab controls are OK in Filemaker, but it’s a bit fiddly to associate a script trigger with a particular tab. For example, in the system that I work on most of the time, I wanted to check users’ access to certain tabs when they click on them.

To do this, I use the “OnObjectModify” script trigger.  This gets triggered whenever user clicks on a tab.  It uses the GetLayoutObjectAttribute function to determine which tab the user has clicked on, and then refers to an access indicator (stored as a global variable during user logon) to determine whether the user has access to it. The script, “Check tab access”, sets a variable, $AccessOK, if the user is allowed to get to the tab.

For this to work, each tab must have an object name.  And, if access is denied, the script must have somewhere to go, i.e. a default tab to which every user has access.  In this case, I made a blank “home” tab.

The only problem with this is that the tab actually gets displayed before access is denied, so there’s a degree of screen flickering, and a slight risk of the user seeing the tab contents before being taken away from it again, but it all happens pretty quickly, so it’s an acceptable risk.

Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s