Controlling user actions / Binding action views to action handlers |
Action views can produce action events that will execute the code of the corresponding action handler in the current interactive instruction of the program.
Action views (like buttons) are bound to a action handlers by the 'name' attribute. Action handlers are defined in interactive instructions with an ON ACTION clause or COMMAND / ON KEY clauses.
BUTTON b1: show_help, TEXT="Show Help";
ON ACTION show_help CALL ShowHelp()
The COMMAND / ON KEY clauses are typically use 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 such clause identify user actions with an abstract name. However, if required, use a COMMAND clause in a non-menu dialog if you want to include the corresponding action view in the focus-able form items.
ON ACTION PrintRecord -- will be compiled as "printrecord"
To avoid any confusion, always write lower-case names for action names (print_record instead of PrintRecord).