April 25, 201213 yr Have to capture current Layout Name, Table Name and Tab Name. First two are done by Get ( LayoutTableName ) and Get(LayoutName). The third, to get current Tab name, should go with Get(TriggerCurrentTabPanel). Manual says that is has to go along with OnTabSwitch script trigger. When I try to set OnTabSwitch script trigger, right click on button, it wont allow me to use it. All other options on trigger menu are available but OnTabSwitch. I did check are Tabs named properly and it seems ok. If anyone can help, please welcome. Best regards
April 25, 201213 yr This trigger is only available for a tab control; the FileMaker Help system states that “… OnTabSwitch applies to the entire tab control and not to individual panels.”
April 25, 201213 yr What is the purpose? If there is more than one tab control on the layout, how do you know which one you want? Or do you want a list of active tabs? Set Variable [ $tab; Value:LayoutObjectNames ( Get ( FileName ) ; Get ( LayoutName ) )] Will give you a list of all the objects on a layout. To get the active tabs I use a loop and GetLayoutObjectAttribute ( LeftValues ( $tabs ; 1 ) ; "isFrontTabPanel" ) = 1 to cull that down to just a list of active tabs
April 26, 201213 yr Author Yes indeed, I got 8 Tab panels on one Layout and need to pass to the script just the active one. At the moment I use Get(ScriptParameter)...but was so in hope that we can do something with Get(TriggerCurrentTabPanel).
April 26, 201213 yr I lookied into it a bit and can't really see any way to capture the object name of the current "Active" tab. If you have one Tab control with 8 tabs then you could probably use the technique I mentioned above. OnTabSwith fire a script that loops through the list of layout objects and use the GetLayoutObjectAttribute ( LeftValues ( $tabs ; 1 ) ; "isFrontTabPanel" ) to pull out the active tab. But if you have multiple tab controls on thelayout you will get a list of front tabs. If I were trying to do this and wanted to grab the object name of the active tab when I click on it. I would probably replace the tabs with buttons that call a script. You would give each tab an object name and pass it using a script parameter. The script would be simply; Set Variable [ $$activeTab; Value;Get ( ScriptParameter ) ] Go To Object [ $$activeTab ]
April 26, 201213 yr Just ran accross this file in the FM Forums file download section. It does exactly what you want using a web viewer and a Let () statement. http://fmforums.com/forum/files/file/16-where-are-you/
April 26, 201213 yr You can use the OnTabSwitch trigger to run a basic script that sets a variable. SetVariable [ $$tabselected; Get(TriggerTargetTabPanel) ]
April 27, 201213 yr Author Ron, thank you so much for your help. Seems as GetLayoutObjectAttribute ( LeftValues ( $tabs ; 1 ) ; "isFrontTabPanel" ) = 1 might bring some result, I'll post here as soon as I make it work in my case. Mr Vodka, that is what I did try as first and it wont go.
January 13, 201312 yr Getting in the Way Back Machine here... One critical clarification that I think needs to be made here (and perhaps this is what Mr. Vodka was implying, but it wasn't clear to me): you need to use these function calls INSIDE the trigger script, NOT as script parameters to the script you are calling on the trigger. If you use them as script parameters, you will get a result of "0". -- J
Create an account or sign in to comment