Form Control Attributes
- Last UpdatedNov 01, 2022
- 2 minute read
A button may optionally have a form control attribute, such as OK, which takes effect after the callback command is invoked.
It is convenient, but not essential, to give a button the same PML name and displayed tag name as its control attribute.
If no form control attribute is specified, the effect of the button depends entirely on the callback or the showing of a child form.
You can only have one of each type of control attribute on any form, apart form APPLY which may be used on several buttons.
|
Control Attribute |
Purpose |
|---|---|
|
OK |
Allows you to approve the current gadget settings and action the form. The form nest’s OKCALL callbacks are run (see Form OK and CANCEL Callbacks) and the nest is hidden. Any callback on the OK button is ignored. |
|
APPLY |
Similar to OK in that the gadget settings are approved and the form is actioned but not removed from the screen. There may in fact be several APPLY buttons for different sections of form (ideally each section within its own Frame). A form with one or more APPLY buttons should also be given a DISMISS button for removing it from the screen. |
|
CANCEL |
Allows you to decide not to proceed with the form. The form nest’s CANCELCALL callbacks are run and the nest is hidden. All gadget values are reset to their initial settings or to the values established at the last APPLY. |
|
RESET |
Returns the values of all gadgets on the form to the values they had when the form was displayed. If you have since pressed an APPLY button, the form gadgets are reset to the values they had when the APPLY button was last pressed. The callback is then invoked in which your PML code should make sure that anything that needs undoing is indeed undone. |
|
HELP |
Invokes online help. |
The effect of OK and CANCEL on gadgets is more extensive if a form family is involved, as described in Free Forms and Form Families.
Examples:
button .Ok AT . . . 'OK' CALLBACK '!!MyOkFunction()' OK
button .Apply 'Apply' CALLBACK '!!MyApplyFunction()' APPLY
button .Cancel 'Cancel' CALLBACK '!!MyCancelFunction()' CANCEL
button .reset AT . . . 'Reset' RESET
button .help AT . . . 'Help' HELP