When you need to identify a key on the user's keyboard, as in
consoleLib.getKeyCode(),
use one of the keywords below. You typically refer to these names
as quoted strings.
- ASCII characters
- You can represent any of the 95 printable ASCII characters (numbered
32-126) with the character itself, though for clarity, you can find
several of them (for example, SPACE) in the "Special characters" section
later. You can also put the keyword KEY_ in front of the character,
as in KEY_a, KEY_A, or KEY_\.
- Control characters
- You can represent most control characters with the keywords CONTROL_A
through CONTROL_Z, however, the following keystrokes have special
meanings in Console UI:
- CONTROL_C
- The EGL runtime reads this as an interrupt character, terminating
the program.
- CONTROL_G
- This input causes the EGL runtime to toggle a character-sized
grid on and off.
- CONTROL_H
- The EGL runtime reads this as a BACKSPACE.
- CONTROL_I
- The EGL runtime reads this as TAB.
- CONTROL_R
- This input causes the EGL runtime to repaint the screen. This
is useful in UNIX or other systems
where other programs can interfere with the display.
- CONTROL_S
- This tells EGL to read the next function key as shifted. EGL interprets
the key combination CONTROL_S + F2 as SHIFT_F2, that is, as F14.
- Holding the shift key when entering a control character does not
change the input. The EGL runtime sees SHIFT_CONTROL_A as CONTROL_A.
The EGL runtime ignores CONTROL_ALT characters.
- Function keys
- EGL recognizes function keys F1 through F24. Users can simulate
keys F13 through F24 by using the shift key. EGL interprets SHIFT_F1
as F13, SHIFT_F2 as F14, and so on.
- EGL reserves keywords for program function keys PKEY_F1 through
PKEY_F24, though the numeric values assigned to them are the same
as those assigned to F1 through F24. EGL cannot distinguish between
the user pressing F1 and PKEY_F1.
- Special characters
- EGL reserves keywords for the following keystrokes:
- BACKSLASH (\)
- BACKSPACE
- DELETE
- DOWN (Down arrow)
- END
- ENTER
- ESC
- ESCAPE
- HOME
- INSERT
- LEFT (Left arrow)
- PAUSE
- PGDN
- PGUP
- RETURN
- RIGHT (Right arrow)
- SPACE (Space bar)
- TAB UP (Up arrow)