INKEY$

 BBS: Inland Empire Archive
Date: 01-31-93 (14:22)             Number: 373
From: ROB MCKEE                    Refer#: NONE
  To: FRED PREUETT                  Recvd: NO  
Subj: INKEY$                         Conf: (2) Quik_Bas
Hello Fred!


 FP> Thanks, I had forgotten to add the null (chr$(0)) before
 FP> checking.

   I use:

    DO
          i$ = INKEY$
          DoUpdateScreenDuringIdleLoop
 LOOP WHILE i$ = ""

 SELECT CASE CVI(i$+CHR$(0))
        CASE  0 to 31: KeyName$= "ASCII Term Codes -" + i$
        CASE  32 to 127: KeyName$= "ASCII -" + i$
        CASE  128 to 255: KeyName$= "HighASCII -" + i$
        CASE  29696: KeyName$= "Cntrl-Right"
  CASE  20736: KeyName$= "Shift-PgDn"
  CASE  20224: KeyName$= "End"
  CASE  15104: KeyName$= "F1"
  CASE -31232: KeyName$= "F12"
  CASE  26624: KeyName$= "Alt-F1"
  CASE  24064: KeyName$= "Cntrl-F1"
  CASE  7680: KeyName$= "Alt-A"
  CASE  46: KeyName$= "."
  CASE  44: KeyName$= ","
  CASE  4: KeyName$= "Cntrl-D"
    End Select

 Here's The Program I use to generate the KeyCodes:
 --------------8<---------------

 DECLARE FUNCTION TheKey$ ()
 OPEN "O", 1, "JNK"
 ' Add or Subtract from the DATA Statement to add or
Subract Keys  ' And YES some keys Don't WORK with this
Program!
 ' I then MERGE the JNK. file into my Program
 DATA Alt-Up,Alt-Down,Alt-Right,Alt-Left,Alt-Home,Alt-End
 DATA Cntrl-End,Cntrl-Insert,Cntrl-Delete,Cntrl-PgUp,Cntrl-PgDn  DATA
Up,Down,Right,Left,Home
 DATA F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
 DATA Alt-F1,Alt-F2,Alt-F3,Alt-F4,Alt-F5,Alt-F6,Alt-F7,Alt-
F8  DATA Alt-F9,Alt-F10,Alt-F11,Alt-F12
 DATA Cntrl-F7,Cntrl-F8,Cntrl-F9,Cntrl-F10,Cntrl-F11,Cntrl-
F12  DATA Shift-F1,Shift-F2,Shift-F3,Shift-F4,Shift-
F5,Shift-F6
 DATA Alt-A,Alt-b,".",",","Cntrl-D"
 DATA llll
 PRINT #1, CHR$(9) + "DO"
 PRINT #1, STRING$(2, 9) + "        i$ = INKEY$"
 PRINT #1, STRING$(2, 9) + "
DoUpdateScreenDuringIdleLoop"  PRINT #1, CHR$(9) + "LOOP
WHILE i$ = " + STRING$(2, 34)
 PRINT #1,
 PRINT #1, CHR$(9) + "SELECT CASE CVI(i$+CHR$(0))"
 DO
     READ F$
     IF F$ = "llll" THEN EXIT DO
     PRINT "Press "; F$; "  :"
     g = CVI(TheKey$ + CHR$(0))
     P$ = STRING$(2, 9) + "CASE " + STR$(g) + ":"
     P$ = P$+ "KeyName$= " + CHR$(34) + F$ + CHR$(34)
     PRINT P$
     PRINT #1, P$
 LOOP

 FUNCTION TheKey$
 i$ = ""
 DO WHILE i$ = ""
     i$ = INKEY$
 LOOP
 TheKey$ = i$
 END FUNCTION


 --------------8<---------------

 Catcha Later , I'll see you on the flip side - Rob
 Vote Zack_Jones,Quik_Bas Moderator

--- timEd/B6
 * Origin: Flyer_Proof_Computer_Svs,V32B,V42B,XA (1:125/1212.13)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET