Tandy 1000 Basic Reference Manual page 234

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter
10 I
BASIC Keywords
ON KEY() GOSUB
Statement
ON KEY(number) GOSUB line
Transfers program control to a subroutine when you press the
specified key.
Number may be
a number in the range 1 to 20, indicating the
number of the key to trap. Function keys use their corresponding
function key numbers. The cursor direction keys are numbered:
11
12
E l
13
E l
14
m
E l
User keys are numbered 15 through 20. User keys are defined
with the KEY statement.
Line
is the first line number in the subroutine to execute when
the specific key is pressed. If you specify Line 0, you turn off key
trapping for that key.
It
is the same as executing a KEYO OFF
statement. Use the RETURN statement to exit the subroutine.
BASIC executes the ON KEYO GOSUB statement only if a
KEYO ON statement has been executed previously to enable key
trapping for that key.
If
a KEYO STOP statement has been issued to halt key trapping
for that key temporarily, BASIC executes the subroutine immedi-
ately after the next KEYO ON statement for that key.
When you execute the ON KEY() GOSUB statement, BASIC im-
mediately issues a KEYO STOP statement for that key to pre-
vent recursive traps. When BASIC executes the RETURN from
the subroutine, it automatically executes another KEY
()
ON
statement for that key to enable key trapping again, unless the
subroutine executes a KEYO OFF statement for that key.
232

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents