6 Replies Latest reply on May 10, 2011 3:32 PM by jeremyturner

    Default Front Tab

    RobertGardner

      Title

      Default Front Tab

      Post

      I've read a number of posts and solutions that attempt to bypass the default front tab on a layout so that when I leave the layout and return, it is on the same tab that it was on when I left.  None of them seem to be working for me.

      What I'm trying to do is have a script that sets a single global field to the front tab name when any tab is clicked so that upon returning to the layout I can trigger the program to go to that named layout object - i.e. the most recent front tab.  Unfortunately, the function GetLayoutObjectAttribute ("FrontTab" ; "IsFrontTabPanel") doesn't return anything close to the right results, and I can't seem to trigger a script right.

      Any ideas?  This shouldn't be THAT hard, right? 

        • 1. Re: Default Front Tab
          philmodjunk

          First make sure that each tab has an object name. This is done using the Name box on the Inspector's position tab.

          Then use OnObjectModify on the tab control to perform the following script:

          #FirstTab, SecondTab and ThirdTab are object names of tabs in the tab control
          Set Variable [ $TabObjects ; Value : List ( "FirstTab" ; "SecondTab" ; "ThirdTab" ) ]
          Set Variable [ $$CurrentTabObject ; "" ]
          Loop
             Set Variable [ $I ; Value : $I + 1 ]
             Exit Loop If [ $I > Valuecount ( $TabObjects ) or Not IsEmpty ( $$CurrentTabObject ) ]
             Set Variable [ $$CurrentTabObject ; If ( GetLayoutObjectAttribute ( GetValue ( $TabObjects ; $I ) ; "IsFrontPanel" ; GetValue ( $TabObjects ; $I ) ) ]
          End Loop

          Upon returning to this layout, use Go To Object [ $$CurrentTabObject ] to select the correct tab.

          Note, this is not the only way that works, but makes it easy to add/change tab object names by editing the values in the first Set Variable step. You can also modify this script to pass the tab object names as a script parameter which lets you use this script with more than one tab control if you want.

          • 2. Re: Default Front Tab
            RobertGardner

            Code worked great with the exception that FMP 10 doesn't recognize the attribute "IsFrontPanel".  I had to write "IsFrontTabPanel" for it to work.  Thanks so much.

            • 3. Re: Default Front Tab
              philmodjunk

              "IsFrontTabPanel" is the correct name for FileMaker 11 as well. That was a typo on my part.

              • 4. Re: Default Front Tab
                jeremyturner

                I'm trying to get this script entered in to FileMaker but have run in to a problem in the script editor. When I paste

                If ( GetLayoutObjectAttribute ( GetValue ( $TabObjects ; $I ) ; "IsFrontPanel" ; GetValue ( $TabObjects ; $I ) )

                in to the script editor and click on "OK" FileMaker tells me "There are too few parameters in this function." and won't let me save. Any ideas what I'm doing wrong?

                • 5. Re: Default Front Tab
                  philmodjunk

                  You have 4 ('s and only 3 )'s Wink

                  • 6. Re: Default Front Tab
                    jeremyturner

                    Thanks. I put a ) after "IsFrontTabPanel" and it works perfectly. Thanks.