Morley Chalmers Posted October 22, 2008 Posted October 22, 2008 Is there a technique available to detect the currently active tab on a tab panel? I'm not pleased with my workaround which requires high maintenance — using a global variable to achieve the same thing. What's the recommended technique? Appreciated.
mr_vodka Posted October 22, 2008 Posted October 22, 2008 Look into the GetLayoutObjectAttribute () function.
Robert Schaub Posted October 22, 2008 Posted October 22, 2008 Is there a technique available to detect the currently active tab on a tab panel? I'm not pleased with my workaround which requires high maintenance — using a global variable to achieve the same thing. What's the recommended technique? Appreciated. Not yet... That is high on my wish list too. Look into the GetLayoutObjectAttribute () function. Does not work with tab sets because it does not see it as an object. Even with the fact that you can name tabs using the object tool.
comment Posted October 22, 2008 Posted October 22, 2008 Does not work with tab sets because it does not see it as an object. It does work for me.
mr_vodka Posted October 22, 2008 Posted October 22, 2008 Does not work with tab sets because it does not see it as an object. Even with the fact that you can name tabs using the object tool. I am curious what you mean by this statement. Could you elaborate on this? A tab panel [color:red]is an object. I dont see why the OP cant figure out if a certain tab panel is active by using GetLayoutObjectAttribute and the isFrontTabPanel attribute.
Robert Schaub Posted October 22, 2008 Posted October 22, 2008 Sorry I thought you meant Get ( ActiveLayoutObjectName ) Thsi function is as good a non global variable and only works if you script it with a Go To Object. Just clicking on a Tab does not update the function as it does wit a field that is a named object . Once you click somewhere else it vanishes I looked into GetLayoutObjectAttribute... which BTW is not listed with the Get Functions.... Anyway I came up with this GetLayoutObjectAttribute ("Tab 1" ;"isFrontTabPanel" ) Which is still a pain because it returns 1 for yes 0 for NO. What if there are 20 tabs? Unless there is a better way I don't know about. Comment, what do you suggest? I did see a sample that uses a plugin that does the trick , I will look for it.
Ocean West Posted October 22, 2008 Posted October 22, 2008 Try this custom function http://www.briandunning.com/cf/699
comment Posted October 22, 2008 Posted October 22, 2008 Just clicking on a Tab does not update the function as it does wit a field that is a named object . Once you click somewhere else it vanishes That's not a good description of what happens. A calculation using GetLayoutObjectAttribute() will return the correct result AT THE TIME IT'S EVALUATED. Clicking "somewhere else" doesn't change the front tab panel (unless you click on another one), so the calculation will still return the correct result. However, a calculation FIELD will NOT be refreshed as a result of merely changing the front panel, and it will keep on displaying the last result until the window is refreshed. I don't see why this should be a problem, since you can see which panel is in front by looking directly at the tab object, instead of at a calculation field. If it's used in a script, it will return the correct result at script runtime. Which is still a pain because it returns 1 for yes 0 for NO. What if there are 20 tabs? Unless there is a better way I don't know about. Comment, what do you suggest? It depends on what you need this for. A custom function MIGHT be required, but I don't see a situation that would call for it.
Robert Schaub Posted October 22, 2008 Posted October 22, 2008 Here's a reason, You have 5 tabs. Each tab contains the same portal sorted 5 different ways. To sort is a simple go to object. I sort by the city which brings me to tab 3. I navigate form the people screen to the Organizations screen. If I don't store the tab I left the people screen somewhere upon returning to the people screen it reverts back to the default tab (which is sorted another way) and I lose my place. What I beleive the oringinal question was. How can I return to the same tab without using scripting and variables or globals for each time I navigate forth and back? (Although he never said it), I know because I had the same situation in many files with many tabs. Without a work around to return to the tab you left on would be nice. Later I will try Steven's CF suggestion.
Fitch Posted October 22, 2008 Posted October 22, 2008 Seedcode has a very cool solution for this: BackMagic. It's free!
comment Posted October 22, 2008 Posted October 22, 2008 I would open a new window to go somewhere else, and close it when I'm done.
Robert Schaub Posted October 22, 2008 Posted October 22, 2008 SeedCode is only Layout specific... It does not track on records level... Cool but not all the way there yet. Open and close windows? I would rather hold it in a Variable or a global.... Can you trust all your users to close the window? Will they navigate as you hope or simply go through the window toolbar leaving window open ,... which then may cause an error becuase it is being modified in another window.
Fitch Posted October 22, 2008 Posted October 22, 2008 (edited) SeedCode is only Layout specific... It does not track on records level... I thought we were talking about restoring the active tab? This does that. Edited October 22, 2008 by Guest Oh, I guess you are talking about non-scripted navigation.
comment Posted October 22, 2008 Posted October 22, 2008 Sorry, I haven't read your question carefully enough. There is NO way, AFAIK, to do this without scripting. If you go to another layout, you will get the default panel when you come back.
Robert Schaub Posted October 22, 2008 Posted October 22, 2008 But wouldn't it be cool if FileMaker let your current tab up without scripting?
Robert Schaub Posted October 23, 2008 Posted October 23, 2008 In the mean time this CF works good if tabs are not nested http://www.briandunning.com/cf/692 With that you can save the steps of set a varible of the tab you are leaving from.. Upon return in the script you would now use Go To Object TableName::CF_Field
Robert Schaub Posted October 23, 2008 Posted October 23, 2008 Well more work is needed , will come back later. Still need to set var. or else it returns to default. Arrrrrrgah
ĸupiэȶƺ Posted May 18, 2009 Posted May 18, 2009 I didn't read the whole thread as I'm in the middle of a hairy project, but here's a very simple current function that will return the active tab. Name your tab objects sequentially, IE as T1...T10 for 10 tabs. (This is the name assigned in Object Info, not the text label displayed on the tab.) Set up a custom function called "func_ActiveTab" with no parameters. Here is the function definition: let([ $$AcTabNo=$$AcTabNo+1; activeFlag=getastext(GetLayoutObjectAttribute ("T"&getastext($$AcTabNo) ;"isFrontTabPanel" )) ]; case( activeFlag=""; let($$AcTabNo="";""); activeFlag="1"; $$AcTabNo+let($$AcTabNo="";0); activeFlag="0"; func_ActiveTab ) ) Note: You may not use the variable $$AcTabNo elsewhere in your file or calling this function will reset it. That's the basics, you can take this much further by storing index lists of tab names (which can be created by carefully parsing the output of the LayoutObjectNames design function) in an unstored calc - that's beyond the scope of this simple solution, but definitely doable. Off the top of my head, this probably won't work well for nested tabs, but could be easily modified to do so. -- Enjoy, Michael Kupietz Recursive Custom Function Maven 1
Recommended Posts
This topic is 5669 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