Challenge: in a system with three privilege sets, Employee, Manager and Administrator, you want to control access to various panels on this tab control like so:
As usual in the FileMaker world, there are various approaches you could take, and today we’re going to look at three of them with the help of these demos:
- Approach #1: conditional tab panel access, v1
- Approach #2: conditional tab panel access, v2
- Approach #3: conditional tab panel access, v3
The basic idea here is to trap the mouse click with an OnTabSwitch trigger (which is a “pre-trigger”, i.e., executes before the click is processed). Since the user in the screen shot below is logged on with the Employee privilege set, they will only be able to access the first three tabs. Clicks on the remaining four tabs will be ignored.
What I like about this approach: it’s super easy to implement. What I don’t like about this approach: unauthorized users can see the “forbidden fruit” of inaccessable tabs.
All of today’s demos have an explanation screen to show what’s going on under the hood…
Here’s the script. We don’t need to use named tab objects; the position of the tab within the control is what matters.
More… Conditional Tab Panel Access | filemakerhacks.