Brian Dunning's FileMaker Custom Functions

func_ActiveTab

Return the number of the currently active tab in a tab object

  Average rating: 4.1 (41 votes) Log in to vote

Michael Kupietz   Michael Kupietz - Show more from this author
Michael Kupietz FileMaker Consulting
http://www.kupietz.com

Share on Facebook Share on Twitter

  Sample input:
[none]
  Sample output:
3

  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.

 

Comments

Peter   Peter, Sydney
Jun 1, 2016
Curious, why have the prefix "T" on the objects?
 
Michael E. Kupietz, FileMaker Consultant   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.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: