Restore Tabs

by Bob Ellis

restoreTabs

Overview

Restore Tabs will save and restore tabs as you move from layout to layout in FileMaker.

Features

  • Works with nested tabs
  • Can be called from another script, a button, or by script triggers
  • Easy to install
  • No custom functions
  • Can easily be adapted to use across sessions

Dependencies

Tabs to be saved and restored must have an object name

Optional: If saved tabs are to be saved into a field instead of a variable, field needs to be created and designated in Configuration script.

License

Completely Free

Credits

Todd Duell at Formulations Pro for sharing an elegant solution demonstrating how to accomplish restoring nested tabs.

Download

Download Restore Tabs

11 responses to “Restore Tabs”

  1. Paul Jansen says:

    Very interesting., Thanks for adding this module. The method I have been using saves the tabs using the trigger on the tab panel. Using the on layout exit trigger is obviously more efficient. I shall definitely be adopting this method in future projects.

    I wonder if the dependencies or installation instructions should include the fact that each tab needs a name!

    • Bob Ellis says:

      Good catch Paul, I thought I had included that part. I have updated the file and this post to reflect the need for tabs to be named.

  2. Scott Howard says:

    The image and download button have lost their objects.

  3. Bob Ellis says:

    Post has been fixed.

  4. Adam S. says:

    The download link appears to be incorrect: there’s an extra “1” right before the “.zip” that needs to be deleted in order for it to download correctly – otherwise it’s 404.

    Thanks,
    -Adam

  5. Bob,

    Nice module. Pain free install! The only (minor) irritation is name spacing of some of the folders. (Public 2…..)

  6. Tom Hays says:

    This is a very well done technique. Thank you for sharing. I expect to use it in my next project.

    In its present incarnation it has a somewhat obscure gotcha. Since the raw layout name itself is used as the key for storing the layout’s information, and the data structure uses $key = “value” notation, the layout name itself cannot have a pattern that confounds interpreting that notation.

    If I change the layout name in the demo from “Restore Tabs: E” to be “Restore Tabs = E”, the method breaks.

    An easy way to fix this is to use Get(LayoutNumber) for the key instead of Get(LayoutName) when creating the $key = “value”. I modified my copy to use “layout” & Get(LayoutNumber) & “_tabs” instead of the original Get(LayoutName) & “_tabs”. That resolved any issues related to layout names breaking the system.

    -Tom

  7. Salman says:

    Looks great!! Is there a simple way to get it to remember tabs on a per record basis?

    e.g. You go to Tab2 for Client1 and then Tab3 for Client2. If you then switch back to Client 1 it will automatically go to Tab2. This would be on a per-user basis as well of course.

  8. Matthew says:

    OnLayoutExit seemed like a great idea in order to avoid having to add the script to each of multiple nested tab sets.

    However, it seems to me that something about the Save Tabs script, when called from an OnLayoutExit trigger, is breaking Go To Related Record when GTRR is called from a button in a portal row inside a tab. It always ends up in the first record in the related set, no matter which row was clicked.

    Nevertheless, the minor inconvenience of calling this with OnObjectModify on any tab sets on the layout is dramatically overwhelmed by having very effective recall of the last visited tab.

    Thank you very much!

  9. Tobias Sjögren says:

    Trying this module with semi luck…
    For some reason on some layouts it’s working just as expected, but on some others it doesn’t.
    My troubleshooting skills are somewhat limited and therefore I can’t figure out what is going on.
    I’ve named all tabs in all layouts. All layouts have the OnLayoutEnter and OnLayoutExit scripts setup. Didn’t change anything in the scripts so $$TABSTORE is at work. The scripts (Save Tabs, Restore Tabs, Configure Restore Tabs) seem to trigger just like they should – but with some layouts the $XXX gets written into $$TABSTORE, while with others it doesn’t…

    I have no idea why it is working with just about half of my layouts… – anyone?

Leave a Reply

Your email address will not be published. Required fields are marked *