Example: ACTION DEFAULTS in custform.per

Action decoration and functional attributes can be defined in the ACTION DEFAULTS section of a form specification file.

While global action defaults should be defined an a .4ad file, local form specific action defaults can be defined in the ACTION DEFAULTS section of a .per file.

Enhance the custform.per file by moving the attribute of the TOOLBAR items or TOPMENU items in a new ACTION DEFAULTS section:

  1 SCHEMA custdemo
  2 
  3 ACTION DEFAULTS
  4 ACTION query (TEXT="Find",IMAGE="find")
  5 ACTION quit (TEXT="Quit", COMMENT="Exit the program", IMAGE="exit")
  6 END
  7 
  8 TOOLBAR
  9 ITEM query
 10 ITEM previous
 11 ITEM next
 12 SEPARATOR
 13 ITEM quit
 14 END
 15 
 16 TOPMENU
 17  GROUP form (TEXT="Form")
 18    COMMAND quit
 19  END
 20  GROUP customers (TEXT="Customers")
 21    COMMAND query
 22    SEPARATOR
 23    COMMAND next
 24    COMMAND previous
 25  END
 26 END
Note:
  • Line 4 defines a default label and default icon for any action view of the form, that is bound to the "query" action.
  • Line 5 defines a default label, default hint and default icon for any action view of the form, that is bound to the "quit" action.
  • Lines 9 and 21 define items for the "query" action, that will be decorated with the attributes defined in line 4.
  • Lines 13 and 18 define items for the "quit" action, that will be decorated with the attributes defined in line 5.
The revised form specification file must be recompiled before it can be used in the program:
fglform -M custform.per