Creating dynamic buttons (FileMaker Pro Advanced)
By using scripts and calculations to evaluate the state of button fields, you can make dynamic buttons that change each time they are clicked.
To create dynamic buttons:
 •
 •
 •
The following example shows how to create a button that changes every time it is clicked.
To define the dynamic button field:
1.
Choose File menu > Manage > Database > Fields tab.
2.
3.
Click Options > Storage tab.
4.
Select the Use global storage checkbox and type the number of button states for the Maximum number of repetitions.
5.
6.
In Browse mode, select the Icons field and choose Insert menu > Picture to add graphics to the Icons field.
Tip  Ensure that all graphics are the same size.
7.
Choose File menu > Manage > Database > Fields tab.
8.
9.
Click Options > Auto-Enter tab.
10.
For Calculated value, click Specify and enter the function GetRepetition (Icons; 1).
Tip  To create a button that displays identically across all records, click the Storage tab and select Use global storage. Otherwise, each record will display its own button state.
11.
Click OK, then OK again.
To create the dynamic button script:
1.
Choose Scripts menu > Manage Scripts and click New.
2.
3.
Add a Set Field script step.
4.
Select Specify target field or click Specify.
5.
6.
For Calculated result, click Specify.
7.
Case (
icons::Buttons = GetRepetition (icons::Icons; 1); GetRepetition (icons::Icons; 2);
icons::Buttons = GetRepetition (icons::Icons; 2); GetRepetition (icons::Icons; 3);
icons::Buttons = GetRepetition (icons::Icons; 3); GetRepetition (icons::Icons; 4);
icons::Buttons = GetRepetition (icons::Icons; 4); GetRepetition (icons::Icons; 5);
GetRepetition (icons::Icons; 1)
)
8.
Click OK and close the Edit Script and Manage Scripts dialog boxes.
To connect the field and the script:
1.
In Layout mode, select the Buttons field.
2.
Click Inspector Inspector button in the layout bar, then click Data.
3.
In the Behavior area, clear Browse Mode and Find Mode.
4.
Choose Format menu > Button Setup.
5.
Select Perform Script and specify Toggle Buttons.
6.
7.
For more information about using buttons with scripts, see Using buttons with scripts.
Related topics 
Displaying databases in Kiosk mode (FileMaker Pro Advanced)
Creating Kiosk solutions (FileMaker Pro Advanced)
Using scripts and buttons to control Kiosk solutions (FileMaker Pro Advanced)
Creating scripts to automate tasks
Working with formulas and functions