Binding action views to action handlers

Defining action handlers in programs

In forms, actions views such as BUTTON form items are bound to ON ACTION or COMMAND action handlers by name. The ON ACTION block defines an action handler with a simple action name. The COMMAND block defines an action handler with a action name, but also decoration attributes such as the label and comment, and it can also define keyboard accelerators, as well as a help topic number.

When using the COMMAND action handler, action views such as BUTTON defined in the form layout can get the focus and are part of the tabbing item list.

Three level action handlers in DIALOG

Action handlers can be defined at three levels inside a DIALOG block:
  1. dialog actions are declared beside sub-dialogs and define global actions for the whole dialog.
  2. sub-dialog actions are declared inside sub-dialogs and define sub-dialog specific actions.
  3. field-specific actions are declared inside sub-dialogs and define field specific actions.
The next code example shows several ON ACTION definitions, at dialog, sub-dialog and field level:
DIALOG
  INPUT BY NAME ... ATTRIBUTES (NAME = "cust")
  ...
    -- field-specific action "cust.cust_city.zoom"
    ON ACTION zoom INFIELD cust_city 
    ...
    -- field-specific action "cust.cust_state.zoom"
    ON ACTION zoom INFIELD cust_state 
    ...
    -- sub-dialog action "cust.check"
    ON ACTION check
    ...
  END INPUT
  DISPLAY ARRAY arr_orders TO sr_ord.*
    ...
    -- sub-dialog action "sr_ord.check"
    ON ACTION check
    ...
  END DISPLAY
  BEFORE DIALOG
    ...
    -- dialog action "close"
    ON ACTION close
    ...
END DIALOG

Action views get activated automatically according to the focus context and the name qualifier (with qualified or unqualified action names).