Action attributes related to decoration, keyboard shortcuts and behavior can be defined with action attributes.
Action attributes define attributes for actions, including decoration such as text, icon, comment, as well as keyboard accelerator (ctrl-?, function keys), and also semantics such as current field validation control when an action is fired.
The action attributes can be defined at different levels, through action defaults, form item attributes and action handler attributes:
Action attributes do not only define action view decoration: It is possible to define the semantics of an action, for example by using the VALIDATE action default attribute. Functional attributes take effect for a given action when the dialog implementing the action handler becomes active.
Action attributes are particularly important to render the default action view (when there is no explicit action view defined in the form). This is typically the case when not form is associated to the dialog.
Action attributes can be defined with action defaults: Common action defaults are defined in a global action defaults (.4ad) file, while form specific actions are define withing the ACTION DEFAULTS section of form files.
If a dialog is not attached to a specific form such as an independent MENU, define the action attributes with the ATTRIBUTES clause on ON ACTION handlers, to render the default view and configure the action semantics. Attributes defined by ON ACTION action-name ATTRIBUTES() will only be applied to the default action view: The elements in the forms do not get decoration attributes defined by dialog action handlers.
The final decoration and functional attribute values are set in this order of precedence:
Consider the following parts of code related to the same action definition, namely "print":
1. A BUTTON item defined in the form specification file:
ATTRIBUTES BUTTON b1: print, TEXT="Print item"; END
2. A dialog instruction with code defining the ON ACTION handler with an ATTRIBUTES clause:
DIALOG ... ... ON ACTION print ATTRIBUTES( ROWBOUND, IMAGE = "printer_2" ) ...
3. The form ACTION DEFAULTS section defining:
form.per: ACTION DEFAULTS ACTION print (IMAGE="printer_1", COMMENT="Print the order", ACCELERATORNAME=Control-P, CONTEXTMENU=NO) END
4. A global .4ad action defaults file defining:
<ActionDefaultList> <ActionDefault name="print" text="Print" image="smiley" /> </ActionDefaultList>
When the dialog executes, the "print" action will get the following functional attributes:
The form button (i.e. the action view) will get the following decoration attribute values: