Binding action views to action handlers

How are action views of the forms bound to action handlers in the program code?

Action views (such as buttons) are bound to action handlers by the name attribute. Action handlers are defined in interactive instructions with an ON ACTION clause or COMMAND / ON KEY clauses.

For example, in the ATTRIBUTES section of the form, a button may be defined as follows:
BUTTON b1: show_help, TEXT="Show Help";
The corresponding action handler (code) in the program will use the "show_help" action name:
ON ACTION show_help 
   CALL ShowHelp()
Other type of action views can for example be toolbar items:
TOOLBAR tb
  ITEM show_help ( TEXT="Show Help" )
  ...
Or BUTTONEDIT buttons (using the ACTION attribute to define the action name):
BUTTONEDIT f1 = customer.cust_city, ACTION = open_city_list;

The COMMAND / ON KEY clauses are typically used to write text mode programs. Such clauses define the name of the action and the decoration label. It is recommended that you use ON ACTION clauses instead, because they identify user actions with an abstract name. However, if required, you can use a COMMAND clause in a non-menu dialog to include the corresponding action view in the focusable form items.

In the ON ACTION action-name clause, the name of the action must be a valid identifier, preferably written in lowercase letters. In the abstract user interface tree (where the action views are defined), action names are case sensitive (as they are standard DOM attribute values). However, identifiers are not case sensitive in the language. The fglcomp compiler always converts the action identifiers of ON ACTION clauses to lowercase:
ON ACTION PrintRecord   -- will be compiled as "printrecord"

To avoid confusion, always use lowercase names for action names (for example, print_record instead of PrintRecord).