QBasic 1.1: Declaring User Defined Keys
Explanation
Declaring User-Defined Keys
To declare a user-defined key, use the following variation of the KEY statement:
Worth knowing
Useful and cross-version information about the programming environments of QBasic, QuickBasic and Visual Basic for DOS.
Syntax
KEY n%, CHR$(keyboardflag%) + CHR$(scancode%) |
Description / Parameter(s)
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. |