Specifications

Chapter 14. Statement Reference
234
Description:
Assigning a string or a control code to a function key
KEY in syntax 1 assigns a string or a control code specified by stringdata to a
function key specified by
keynumber. Pressing the specified function key gener-
ates the assigned string data or control code and then passes it to the user program
as if each character is keyed in directly from the keyboard.
keynumber is a key number assigned to a particular function key. (Refer to
Appendix E, "Key Number Assignment on the Keyboard.")
Specifying 32 will be ignored.
stringdata is a character code ranging from 0 (00h) to 255 (FFh). (For the
character codes, refer to Appendix C, "Character Sets.")
If you specify more than two characters to
stringdata, only the first two char-
acters are valid.
stringdata inputted by pressing the specified function key may be read to the
user program by
INPUT or LINE INPUT statement or INKEY$ or INPUT$
function.
Note that
INKEY$ or INPUT$ (1) function can read only the first one character
of the assigned two. The second character remains in the keyboard buffer and
can be read by the
INPUT or LINE INPUT statement or INKEY$ or INPUT$
function.
If pressed together with the shift key, any numerical key can operate as a function
key.
If you issue more than one
KEY statement specifying a same function key, the last
statement takes effect.
If a null string is assigned to a function key, pressing the function key produces no
key entry. To make a particular function key invalid, you specify a null string to
stringdata as shown below.
KEY 1,""
KEY 2,CHR$(0)
KEY 3,CHR$(&h0)
Defining a function key as a backlight function on/off key
KEY in syntax 2 defines a function key specified by backlightkeynumber as a
backlight function on/off key and sets the length of backlight ON-time specified by
onduration. (Refer to Chapter 13, "Backlight Function.")
backlightkeynumber is a key number assigned to a particular function key.
(Refer to Appendix E, "Key Number Assignment on the Keyboard.")
Pressing the specified backlight function on/off key activates or deactivates the
backlight function.
Specifying a zero (0) or 32 to
backlightkeynumber will be ignored.