'===========================================================================
' Subject: KEYBOARD TEST CODES                Date: Unknown Date (00:00)   
'  Author: Unknown Author(s)                  Code: QB, QBasic, PDS        
'  Origin: KEYBOARD,TEST,CODES              Packet: KEYBOARD.ABC
'===========================================================================
'To use cursor keys and function keys, etc ...

DO
   'Get a key from the keyboard
   DO
      A$ = INKEY$
   LOOP UNTIL LEN(A$)
   'Check if it's a extended (special) key
   IF LEN(A$) = 2 THEN
      'If it is then, make the key code negative
      KY = -ASC(RIGHT$(A$, 1))
   ELSE
      'If normal (within ASCII 1 - 255 range), then make it positive
      KY = ASC(A$)
   END IF

   'Un-comment the following line to test for keycodes
   'PRINT KY          'This will give you a specific number to put into your
                      '  SELECT CASE structure for the key you pressed
   
   'Use SELECT CASE structure to test for keys
   SELECT CASE KY
      CASE 27         'ESC key pressed
         EXIT DO      'bail out
      'Now you can do whatever you want to the key
      'CASE ..., etc ...
   END SELECT
LOOP                   'Infinite loop, bail out when ESC pressed (in SELECT)
