it.bugarski Posted April 25, 2012 Posted April 25, 2012 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
eos Posted April 25, 2012 Posted April 25, 2012 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.”
Ron Cates Posted April 25, 2012 Posted April 25, 2012 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
it.bugarski Posted April 26, 2012 Author Posted April 26, 2012 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).
Ron Cates Posted April 26, 2012 Posted April 26, 2012 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 ]
Ron Cates Posted April 26, 2012 Posted April 26, 2012 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/
mr_vodka Posted April 26, 2012 Posted April 26, 2012 You can use the OnTabSwitch trigger to run a basic script that sets a variable. SetVariable [ $$tabselected; Get(TriggerTargetTabPanel) ]
Ron Cates Posted April 26, 2012 Posted April 26, 2012 Get(TriggerTargetTabPanel) Aha, I missed that one :)
it.bugarski Posted April 27, 2012 Author Posted April 27, 2012 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.
mr_vodka Posted April 27, 2012 Posted April 27, 2012 Please explain what you mean. You have to set a variable with the trigger.
Justin Close Posted January 13, 2013 Posted January 13, 2013 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
Recommended Posts
This topic is 4331 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now