Developer’s Guide

Table Of Contents
42 FileMaker Developer’s Guide
Creating dynamic buttons
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:
1. Define the dynamic button field.
2. Create the dynamic button script.
3. Connect the field and the script.
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 > Define > Database > Fields tab.
2. Create a field named Icons and make it a Container type.
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. Click OK.
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 > Define > Database > Fields tab.
8. Create a container field named Buttons.
9. Click Options > Auto-Enter tab.
10. For Calculated value, click Specify and enter the function
GetRepetition (Icons; 1)
11. Click OK.
To create the dynamic button script:
1. Choose Scripts menu > ScriptMaker and click New.
2. Name the script Toggle Buttons.
3. Add a Set Field script step.
4. For Specify target field, click Specify.
5. Double-click Buttons.
6. For Calculated result, click Specify.
7. Write a Case function that evaluates each GetRepetition test
expression for the icon number and increments the number by one.
Vertical scroll bar Scroll Window (if the layout is longer than one
screen)
Horizontal scroll bar Scroll Window (if the layout objects are wider
than one screen)
Window size and location Move/Resize Window
To emulate these
interface elements
Create buttons with these
script steps attached
Graphics buttons added to a repeating field
Global repeating field
Repetition number