EasyManua.ls Logo

CipherLab 8 Series

CipherLab 8 Series
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
54
CipherLab BASIC Programming Part I
ON KEY … GOSUB … 8000, 8200, 8300, 8400, 8700
Purpose To activate “KEY Event Trigger”.
Syntax ON KEY(number%) GOSUB SubName|SubLabel
Remarks number%” is an integer variable.
When “number%
” is an integer variable in the range of 1 to 12, it indicates
a function key (F1~F12) of the keypad.
Call ON KEY(256+KeyCode%) to
trigger a key event by key code. Any key
will do as long as its key code can be read by INKEY$. Refer to
Key Code
Table.
SubName|SubLabel” is the name or line label of a subroutine.
When a key is pressed, a specific subroutine will be executed.
ON KEY command allows a total of 12 key event trigger.
If more than 12 key events are required, you may reserve the last one for ON
KEY(256+255). When ON KEY(256+255
) is called, a key press can be used to
trigger execution
of a corresponding subroutine, as long as its key code is
found less than 0x20 or greater than 0x7F. Use INKEY$ and ASC to get the key
code, and parse key codes in the subroutine.
One key can be used to trigger execution of one subroutine. If a key is set
as a
event trigger using ON KEY(256+KeyCode%
), the same key cannot be used to
trigger the event of ON KEY(256+255
). Likewise, when ON ESC has been
activated, the ESC key cannot be used to trigger the event of ON
KEY(256+255).
Example (1)
REM Set KEY_F1 and KEY_F2 as event trigger
ON KEY(1) GOSUB On_Shift
ON KEY(2) GOSUB Off_Shift
On_Shift:
Mode$ = “IN”
RETURN
Off_Shift:
Mode$ = “OUT”
RETURN
Example (2)
REM Set KEY_F13 as event trigger
ON KEY(256+144) GOSUB KeyEvent
KeyEvent:
PRINT “KEY_F13 is pressed.”
RETURN

Table of Contents

Related product manuals