qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
KEY Statement (Assignment)
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Assigns string values to function keys and, optionally, displays key values.
 
KEY key%, stringexpression$
KEY LIST
KEY ON
KEY OFF
 
    ■ key%                 The number of a function key. Use 1 through 10 for
                           function keys F1 through F10. Use 30 and 31 for
                           function keys F11 and F12 on extended keyboards.
    ■ stringexpression$    A string of up to 15 characters that is returned
                           when the function key is pressed.
    ■ LIST                 Displays the assignments for each key.
    ■ ON                   Turns on the function-key display line.
    ■ OFF                  Turns off the function-key display line.
 
Example:
    KEY 4, "MENU" + CHR$ (13)
    KEY LIST
    KEY 4, ""
    KEY LIST
 
See Also    KEY, ON KEY (Event Trapping)