7 Replies Latest reply on Mar 25, 2012 6:06 PM by furgon575



      Hello all! I have a layout with four different filtered portals on four Tabs, how can I get focus an a specific tab based on a record? I know I have to use a triggered action like onRecordLoad but how would a script addresses the focus of a tab?


        • 1. Re: Scripting

          You can give each tab an object name. While in layout mode, first select the tab you want to navigate to then choose the position tab in the inspector. At the top where it says name, you can label the object for future reference. Now in scripting, you scan use the Go to Object script step found under the Navigation section. You can use an object name for each tab and switch to it as desired in your script.





          • 2. Re: Scripting

            Hi furgon575,


            You would name each tab as an Object ( Inspector > Position and Name ) - I will use T1 and T2 for this example and their portals are P1 and P2 respectively.  Script would be similar to:


            If [ 'this condition ]
            Go To Object [ T2 ]


            Go To Object [ T1 ]

            End If


            And then in Layout Setup > Script Triggers, select this script for OnRecordLoad.


            But a bit of caution on your portals ... if you plan to script going to a field in a portal or going to a portal row, FM can lose its focus and end up on the wrong portal.  For instance, you can even BE in a portal on tab 2 and if you script 'Go to Portal Row [ next ] ... it can  WILL leave your portal and go to the FIRST tab with a portal (even if it is not the same table occurrence).  Even if you specify Go To Field[], it can still mis-direct because if you later add that field to a front tab, Go To Field[] will mis-direct to the front tab (even if it is sitting in another field in the portal within the tab and even if it is dropped lower in stacking order).


            If you jump around in those portals and fields which are on tabs ... name your portals also (or instead).  Once you issue a Go To Object [ P2 ], all subsequent Go To Field[], Go To Next Field, Go To Portal Row[] ... they all will then STICK to that portal. 

            I always name my portals now and any script which might touch a portal is started with Go To Object [ portalname ] because later I might want to place that portal on a tab, change stacking order, or add another porttal and it protects from it breaking or from the tab changing because it jumped to wrong tab.


            Here is a link for a good example experienced by Ron on another forum:  http://fmforums.com/forum/topic/82788-selecting-1st-portal-row-field/page__fromsearch__1


            Hi Brett, I had not seen your post when I responded.  :^)

            • 3. Re: Scripting



              No problem. Your reply was more exhaustive and highlights important points regarding portals within the tabs. It's all good!



              • 4. Re: Scripting

                furgon575 wrote:


                four different filtered portals on four Tabs


                I wonder if the same thing could not be achieved with one portal and four buttons to set the filtering.

                • 5. Re: Scripting

                  I didn't consider that those four portals might be based upon the same table occurrence!  Good question.

                  • 6. Re: Scripting

                    Thanks for the help I will try it and see how it work. I'm using four differnent TOs.


                    Thanks guys

                    • 7. Re: Scripting

                      Hi LaRetta!


                      I put the script together and it works perfectly.


                      Thank you again.