Using macros to display a dialog box
You can create a macro to display a custom dialog box and set its initial values, using the {DODIALOG} macro command. The most important argument in {DODIALOG} is the third argument, which outlines cells that contain the initial settings of the dialog box controls. Each cell in the block (starting at the upper-left cell and proceeding row by row to the lower-right cell) sets the initial value of one control. If you cancel the dialog box, the values in this block remain unchanged.
Each control stores one setting. You manipulate the control (by clicking a scroll arrow, typing text, and so on) to change that setting. There are several ways to set a control’s value:
•
|
|
through initial settings you send (or pass) using a {DODIALOG} command
|
•
|
|
by changing a setting in the dialog box
|
•
|
|
using the {SETOBJECTPROPERTY} command.
|
•
|
|
with link commands from any dialog box control
|
For example, the following macro command uses the Value property to enter Spanish in an edit box: {SETOBJECTPROPERTY “Dialog1:EditField3.Value”,”Spanish”}
You can change the order for setting initial values. As well, you can reorder controls.
For additional information, see the reference section “Example of using macros to display a dialog box.”
To display a dialog box and set initial values |
1.
|
|
Set up an area in a notebook that will send default settings to the dialog box.
|
2.
|
|
Type a {DODIALOG} macro command that displays the dialog box and sends the choices back to the notebook. The {DODIALOG} macro must contain the following arguments:
|
•
|
Argument 3 — specifies a block that contains initial values for the dialog box controls, and receives final values from the dialog box controls when the dialog box is closed
|
•
|
Argument 4 — specifies whether you should manipulate the dialog box (1) or if the macro should manipulate it (0). The default is 1.
|
•
|
|
If a control’s Process value property is set to No, the control will not receive an initial value. Controls that do not have a Process value property have no initial value.
|
•
|
|
If you want to make a dialog box dynamic so that changes are immediately reflected in the notebook, add link commands to each control. For information about using link commands, see “Attaching actions to dialog box controls.”
|
To change the order for setting initial values in a dialog box |
1.
|
|
Click the Quick tab button at the bottom of the application window to display the Objects sheet.
|
2.
|
|
Double-click a dialog box.
|
3.
|
|
Click the dialog box background.
|
None of the controls should be selected.
|
4.
|
|
Hold down Shift, and click each control in the order in which you want to send initial value settings.
|
5.
|
|
Click Format Value order Set new.
|
To reorder controls in a dialog box |
1.
|
|
Click the Quick tab button at the bottom of the application window to display the Objects sheet.
|
2.
|
|
Double-click a dialog box.
|
3.
|
|
Click the dialog box background.
|
None of the controls should be selected.
|
4.
|
|
Click Format Value order Reorder from first.
|
5.
|
|
Hold down Shift, and click each control in the order in which you want to send values.
|