The script steps needed depend on the version of FileMaker that you have. FileMaker 12 added new script triggers specifically for this purpose so the scripting is much simpler in that version.
In older versions, you can use the OnObjectModify trigger in conjunction with the GetLayoutObjectAttribute function to perform a script that determines which panel of your tab control is the frontpanel in order to put this object name into a global variable.
I'm using 12a
Then you have a new script trigger: OnTabSwitch that can use a newly added get function to capture the name of the tab panel that pops to the front when the trigger is tripped:
Set Variable [$$Tab ; Value: GetValue ( Get ( TriggerTargetTabPanel ) ; 2 ) ]
and now you can use this step:
Go To Object [ $$Tab ]
to return that tab panel to the front of the tab control.
Note that with nested tab controls, you'll need to set up this trigger to perform this script on each tab control.
I am trying to create a script as you mentioned above, however I am getting the following error message.
Sorry, my attachment was not sent. See new attached file.
I guess i should have been clearer on my previous post:
I have a Layout with a Tab Control (Main_Tab_Control) having 5 tab panels. The first tab panel is used to determine what information is displayed on the following tab panels, based on several drop-down menus. On the last tab panel I want to nest an additional Tab Control (Sub_Tab_Control). Based on the information from the the first tab panel, I want this Tab Control to display only tabs that are needed.
Ex: on the first tab panel a drop-down menu displays how many floors the building has "1, 2, 3, 4, and so on". Sub_Tab_Control has 10 tabs for 10 floors. If 3 is selected, then I want only tabs 1, 2, and 3 displayed.
I hope this helps.
I am using FM 13Pro Advance.