User interface basics / Special features |
Labels can be defined to decorate buttons controlled by ON KEY/COMMAND KEY action handlers.
Key label configuration can take place at different levels.
key.key-name.text = "label"
CALL fgl_setkeylabel( "key-name", "label" )
KEYS key-name = [%]"label" [...] [END]
CALL fgl_dialog_setkeylabel( "key-name", "label" )
KEY key-name = [%]"label"
When using the graphical mode, ON KEY and COMMAND KEY action handlers in dialogs can be shown as form buttons when a label text is defined for the key. By defining a label for a key, the runtime system will automatically show a default button for the key action.
In the next example, the function key F10 is used to show a detail window in this interactive dialog:
INPUT BY NAME myrecord.* ON KEY (F10) CALL ShowDetail() END INPUT
By default, if you do not specify a label, no default action button is displayed for a function key or control key.
If the text provided for the key label is empty or null, the default action button will not be displayed.
Key Name | Description |
---|---|
f1 to f255 | Function keys. |
control-a to control-z | Control keys. |
accept | Predefined dialog validation action. |
interrupt | Predefined dialog cancellation action. The action name is cancel, not interrupt. |
insert | Predefined INPUT ARRAY dialog row insertion action. |
append | Predefined INPUT ARRAY dialog row addition action. |
delete | Predefined INPUT ARRAY dialog row deletion action. |
help | Predefined help action. |
Key labels can be defined at different levels. The order of precedence for key label definition is the following:
In Genero, you typically define action labels with action attributes. However, if key labels are defined, they will overwrite the text defined in action attributes for the corresponding key action. In BDS 3.xx versions, default key labels are defined in FGLDIR/etc/fglprofile. These defaults have been commented out in Genero to have action attribute text applied (In Genero, by default, fgl_getkeylabel() returns NULL for all keys). If you want to get the same default key labels as in BDS 3.xx, uncomment the key.* lines in FGLDIR/etc/fglprofile.
You can query the label defined at the program level with the FGL_GETKEYLABEL function and, for the current interactive instruction, with the FGL_DIALOG_GETKEYLABEL function.