
Chapter 14. Statement Reference
260
Syntax:
ON KEY (keynumber) GOSUB label
Parameter:
keynumber
A numeric expression which returns a value from 1 to 31, 33 to 38, and 501
to 550.
Description:
According to
label
,
ON
KEY
...
GOSUB
specifies the first line of an event-handling
routine to be invoked if a function key specified by
keynumber
is pressed. (Refer
to Appendix E, "Key Number Assignment on the Keyboard.")
•
ON
KEY
...
GOSUB
specifies only the location of an event-handling routine but does
not enable keystroke trapping. It is
KEY
ON
statement that enables keystroke
trapping. (Refer to KEY ON and KEY OFF.)
• Specification of zero (0) to
label
disables keystroke trapping.
• If a keystroke trap occurs, the Interpreter automatically executes
KEY
OFF
state-
ment for the pressed function key before passing control to an event-handling rou-
tine specified by
label
in
ON
KEY
...
GOSUB
statement. This prevents a same
event-handling routine from becoming invoked again by pressing a same function
key during execution of the routine until the current event-handling routine is com-
pleted by issuing a
RETURN
statement.
When control returns from the event-handling routine by a
RETURN
statement,
the Interpreter automatically executes
KEY
ON
statement.
If it is not necessary to resume keystroke trapping, you describe a
KEY
OFF
statement in the event-handling routine.
• If you issue more than one
ON
KEY
...
GOSUB
statement specifying a same
key-
number
, the last statement takes effect.
• You can nest
GOSUB
statements to a maximum of 10 levels.
I/O statement
ON KEY...GOSUB
Specifies an event-handling routine for keystroke interrupt.
Summary of Contents for BHT-BASIC 100 SERIES
Page 1: ......
Page 161: ...153 Chapter 10 Sleep Function CONTENTS 10 1 Sleep Function 154...
Page 163: ...155 Chapter 11 Resume Function CONTENTS 11 1 Resume Function 156...
Page 173: ...165 Chapter 13 Backlight Function CONTENTS 13 1 Backlight Function 166...
Page 249: ...241 Example CLOSE IF kyIn Y THEN KILL Master Dat END IF Reference Statements CLFILE...