COMMAND KEY() block

The COMMAND KEY(key-name) block (without an option text) defines a menu action handler with a set of instructions to be executed when an action is invoked. The KEY() clause defines one or several accelerator keys separated by a comma. The specified key name must be one of the virtual keys.

For backward compatibility, a coma-separated key list is supported in the KEY() specification. Consider using a single key for new developments, or prefer accelerator definition with action defaults.

While a COMMAND KEY(key-name) "option-name" (with option text) defines the name of the action with the option text (converted to lowercase), a COMMAND KEY(key-name) (without option text), defines the action name from the last key in the KEY() list, converted to lowercase letters. For example, with COMMAND KEY(F10,F12,Control-Z), the name of the action will be "control-z".

Action defaults will be applied by using the key name of the KEY() clause. With a list of keys, the last key name will be used to apply action defaults, because it defines the action name.

The KEY() clause can specify up to four accelerator attributes for the action. The keys defined in the program will take precedence over accelerators defined with action defaults.

By default, COMMAND KEY(key-name) actions are not decorated with a default action (i.e. a button in the action frame will not appear for these actions). However, by defining the text attribute within action defaults, the default action view button will be visible. This allows you to decorate existing COMMAND KEY(key-name) clauses with graphical buttons without changing the program code.

To write abstract code without decoration in your programs, use the ON ACTION clause instead of COMMAND [KEY], except if the action view must get the focus.

In TUI mode, actions created with COMMAND [KEY] do not get accelerators from action defaults; Only actions defined with ON ACTION will get accelerators of action defaults.