ON KEY Statement
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Branches to a routine when the specified key is pressed; not available when
forms are showing; cannot be used with object-specific events.
ON KEY(n%) GOSUB {linenumber | linelabel}
■ n% Value that specifies a function key, arrow key, or
user-defined key:
Value Description
══════ ════════════════════════════════════════════
0 All keys listed (KEY(0) ON, KEY(0) OFF, and
KEY(0) STOP only)
1 - 10 Function keys F1 - F10
11 Up arrow key
12 Left arrow key
13 Right arrow key
14 Down arrow key
15 - 25 User-defined keys
30, 31 Function keys F11 and F12
■ linenumber First line of an event-handling routine to execute
linelabel when a function key, arrow key, or user-defined key
is pressed
See Also
◄Declaring User-Defined Keys► ◄Error/Event Trapping Summary►
◄KEY Statement (Assignment)► ◄Keyboard Scan Codes►
◄KEY Statement (Event Trapping)► ◄KeyDown Event►
◄KeyPress Event► ◄KeyUp Event►