A SERVICE OF

logo

Chapter 2
|
Customizing database solutions 19
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.
8. Click OK.
To connect the field and the script:
1. Choose View menu > Layout Mode.
2. Select the Buttons field and choose Format menu > Field/Control >
Behavior.
3. Clear both Allow field to be entered checkboxes and click OK.
4. Choose Format menu > Button Setup.
5. Select Perform Script and specify Toggle Buttons.
6. Click OK.
You can switch to Browse mode and test your dynamic button. For
more information about using buttons with scripts, see Help.
Graphics buttons added to a repeating field
Global repeating field
Repetition number
Case function for dynamic buttons