I can conceive of two approaches:
Design two layouts, one with tab panels 1..3 and one with panels 1..4. Use your scripts and security settings to take a user to the layout appropriate for their priviledge set.
This can be easier to set up but doubles your work load anytime you have to update the design of this layout.
Use the OnObjectModify script trigger for the tab control to 1) Identify the front tab panel and 2) check privilege set name to determine whether the user has access privileges for that tab panel. This keeps it all on one layout, but requires a pretty complex script.
You use LayoutObjectAttributes to detect which panel "isFrontPanel" and this requires a set of If-else If steps to test each panel in turn to find out which one is the front panel.
You then need to use go to object or go to field to reset the focus on the appropriate tab panel to keep the unauthorized panel from appearing. This can require setting object names on each panel and storing the current panel object name in a global variable so that your script can correctly select the panel that was in front when the user clicked tab 4 when they didn't have access.
I guess, I will go for the first option.
Thanks for the guidance.
You could conditionally format the 4th tab and make it the same color as the background (i.e. unauthorized users would not even see there was a 4th tab) then have the script exit out if the user's priveledge does not allow them to view the 4th tab if they do happen to click on the invisible tab.
Hello Mark Gores
It sounds brilliant! I'll try it.
As a matter or fact Option A, turned out to bring some disruption in my current setting; not the fault of the approach, just my current layout setting and the dozen of interconnected scripts.
Hmmm, but how do you conditionally make that tab panel #4 appear and disappear? You can change fill colors with conditional formats, but not the tab border...
Which works only if the tab control BORDERS are always transparent or zero width---don't know if that would look right when you want the panels to be visible...
The way I interpreted it was to make invisible all the Tabs Control tabs.
Recreate the tabs with buttons and finally apply the conditional formatting.
This was described sometime ago http://sixfriedrice.com/wp/tab-controls-without-the-tabs/
Here again, there is another opportunity for FM Inc to improve FM 11 Pro.
If this helps...
I created a solution that was pretty heavily engrained in privileges to different modules, different submodules and then different actions on those (read only or read/write).
I wanted exactly what you said: having users only see tabs they have access to. And I figured out a way.
What I did is that I set up a table that contained the tab names and the order I wanted them to be sorted in (you could even work out a way to have each user choose the sort order). Then I created a privileges table. On file open a script triggers to check what privileges the user has, what tabs he has access to and populates the global fields that display as the tab names so that the tabs say something. All the tabs have conditional formatting to where if the global field that has that tabs label is empty it appears ass background, if that tab is selected it appears highlighted, or if it is not selected but visible appears in another way.
Same script to control traffic on all tab names, the script would exit if that tab is inactive or redirect to another script based on the name of that tag.
This is the general idea of what I did...
The layout design could accomodate ten modules with 10 submodules in each. So basically, one hundred different layouts that come out of the same top 30 pixles of the screen with the variation of what the tabs say depending on which are activated...
Hello Carlo Martinez,
Glad you shared your approach.
I am not at that level of mastery yet, but it will be very helpful to the FM community.