Navigating between tabs in a tab panel using scripts

How to navigate between tabs in a tab panel using scripts

An easy way to navigate between tabs, is to name the tabs and use the Go To Object script step. In this example we have a database named EG6145 with a Layout that has a Tab Control with two tabs:

Tab A
Tab B

First, use the Inspector (‘Object Info’ in FileMaker Pro 10 and earlier) to name each tab. You can assign names to objects and grouped objects. Some script steps and functions use these names to specify which object to act upon.

To name an object:

In Layout mode, select the tab that you want to name.
Choose View menu > Inspector (or Object Info).
Under the Position tab (or in the Info palette), type a value for Name (or Object Name). For example, Tab A
Press Enter or Tab, or click outside the Inspector(or Info Palette) to apply the object name.
Repeat this for every tab you want to navigate to. The Inspector (or Info palette) floats above document windows, so you can leave it open as you work.

Next, we need to create two scripts.

Choose Scripts menu > Manage Scripts (ScriptMaker in FileMaker Pro 9 and earlier).
In the Manage Scripts (or Define Scripts) dialog box, click New.
For script Name type “Go To Tab A” and add the following script step:
Go to Object [Object Name: “Tab A”]
Click Specify to display the Go to Object Options dialog box, where you can set the Object Name, in this case “Tab A”, to make active on the current layout.
Click OK
Repeat the process for the second script.

In the Manage Scripts dialog box, click New.
For script Name type Go To Field B and add the following script step:
Go to Object [Object Name: “Tab B”]
Click Specify to display the Go to Object Options dialog box, where you can set the Object Name, in this case “Tab B”, to make active on the current layout.
Click OK to return to the Manage Scripts dialog box.
Click OK again to exit the Manage Scripts dialog.
NOTE: Do not use quotes around the object name.

Next we need to attach the scripts to new buttons in the Tab Controls.

In Layout mode, choose the layout with the Tab Control and select Tab A
Add a button to the Tab Control by clicking on the Button tool in the tool panel. Choose a starting point on your layout and drag the crosshair pointer diagonally until the button is the size you want, then release the mouse button. You can also choose Insert menu > Button.
In the Button Setup (previously Specify Button) dialog select “Perform Script” from the list of available script steps.
Click Specify.
In the “Specify Script” Options select the script “Go To Tab B” and Click OK.
Click OK to exit the Button Setup dialog.
Name your button “Go To Tab B”
Select Tab B and repeat the process by adding another button to the Tab Control.

In the Specify Button dialog select “Perform Script” from the list of available script steps.
Click Specify.
In the “Specify Script” Options select the script “Go To Tab A” and Click OK.
Click OK to exit the Button Setup dialog.
Name your button “Go To Tab A”.
Enter Browse Mode (save changes to your layout if you see a prompt) and click on each button to see how this toggles between tabs.

Link
https://support.claris.com/s/article/How-to-navigate-between-tabs-in-a-tab-panel-using-scripts-1503692934418?language=en_US

Leave a Comment

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

Scroll to Top
Share via
Copy link