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.
Declaring User-Defined Keys
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
To declare a user-defined key, use the following variation of the KEY
statement:
 
KEY n%, CHR$(keyboardflag%) + CHR$(scancode%)
 
    ■ n%               A value in the range 15 through 25 that identifies
                       the key.
    ■ keyboardflag%    One of the following values, or a sum of values,
                       specifying whether the user-defined key is used in
                       combination with the Shift, Ctrl, Alt, NumLock, or
                       Caps Lock keys, or with extended keys:
 
                       Value            Key
                       ═════════════    ═══════════════════════════════════
                       0                No keyboard flag
                       1 through 3      Either Shift key
                       4                Ctrl key
                       8                Alt key
                       32               NumLock key
                       64               Caps Lock key
                       128              Extended keys on a 101-key keyboard
 
                       To specify multiple shift states, add the values
                       together. For example, a value of 12 specifies that
                       the user-defined key is used in combination with
                       the Ctrl and Alt keys.
 
    ■ scancode%        The scan code for the key being declared.
                       See Keyboard Scan Codes.
 
See Also    KEY (Assignment)    KEY, ON KEY (Event Trapping)