Return the number of the currently active tab in a tab object
Average rating: 4.1 (41 votes) Log in to vote
Mike Kupietz - Show more from this author
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This function uses a recursive call and FileMaker's design functions to return the number of the currently active tab in a tab object on the current layout. Tabs must be named as "T" followed by the number of the tab , IE as T1...T10 for 10 tabs. (This is the name assigned in Object Info, not the text label displayed on the tab.)
Note: You may not use the variable $$AcTabNo elsewhere in your file, as calling this function will reset it.
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 tab objects, or a layout with more than one tab object on it, but could be very easily modified to do so.
Jun 1, 2016
|Curious, why have the prefix "T" on the objects?|
Michael E. Kupietz, FileMaker Consultant, San Francisco, CA
Sep 29, 2016
|It was just an arbitrarily-chosen convention, to distinguish tabs from any other objects on the layout, and to prevent starting an identifier or object name with a digit. There's no specific prohibition against doing that, but in general it's bad programming practice.|
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.