Evaluates a key code (such as 301) and returns a character string that is the predefined keyboard label for that key (such as F1).
Note: Does not apply to SpeedScript programming.
Syntax
KEYLABEL ( key-code )
key-code
The key code of the key whose label you want to know. A special case of key-code is LASTKEY. See OpenEdge Development: Programming Interfaces for a list of key codes and key labels.
Example
This procedure reads each keystroke the user makes, leaving the procedure only when the user presses GO. The KEYLABEL function tests the LASTKEY pressed, and returns the label of the key. (Remember that the value in LASTKEY is the key code of the last key pressed.)
r-keylbl.p
DISPLAY "Press the " + KBLABEL("GO") + " key to leave procedure"
FORMAT "x(50)".
REPEAT:
READKEY.
HIDE MESSAGE.
IF LASTKEY = KEYCODE(KBLABEL("GO")) THEN RETURN.
MESSAGE "Sorry, you pressed the" KEYLABEL(LASTKEY) "key.".
END.
Note
Some key codes can be associated with more than one key label. The KEYLABEL function always returns the label listed first in the ABL table of key labels.