Download text file
Hi,
It seems that there have been a rash of key-press questions popping
up again (must be the weather:) so I've prepared the following for
those of you who are still struggling with it. The 2 charts below
display all the CHR$() values for the related key-presses. If the
key you need to use as 2 values ( eg: 0,059 ) then you will need to
represent it as CHR$(0,59) or CHR$(0)+CHR$(59) depending on the
version of BASIC you are using.
I strongly recommend you have a look at the message fGetKey% and
integrate that sytem of passing key-strokes into your code as it
is much more efficient.
At the bottom of the file are 3 versions of the fGetKey$ function;
one for PB3.2, one for FirstBASIC and one for the Q*BASICs.
Ú KEY ÄÂÄÄÄÄÄÂÄ SHIFT ÂÄ CTRL ÂÄ ALT Ä¿ÚÄ KEY ÄÂÄÄÄÄÄÄÄÂÄ CTRL ÂÄ ALT Ä¿
³ F1 ³ 0,059 ³ 0,084 ³ 0,094 ³ 0,104 ³³ HOME ³ 0,071 ³ 0,119 ³ ----- ³
³ F2 ³ 0,060 ³ 0,085 ³ 0,095 ³ 0,105 ³³ UP ³ 0,072 ³ 0,141 ³ ----- ³
³ F3 ³ 0,061 ³ 0,086 ³ 0,096 ³ 0,106 ³³ PgUp ³ 0,073 ³ 0,132 ³ ----- ³
³ F4 ³ 0,062 ³ 0,087 ³ 0,097 ³ 0,107 ³³ LEFT ³ 0,075 ³ 0,115 ³ ----- ³
³ F5 ³ 0,063 ³ 0,088 ³ 0,098 ³ 0,108 ³³ 5 ³ 0,076 ³ 0,143 ³ ----- ³
³ F6 ³ 0,064 ³ 0,089 ³ 0,099 ³ 0,109 ³³ RIGHT ³ 0,077 ³ 0,116 ³ ----- ³
³ F7 ³ 0,065 ³ 0,090 ³ 0,100 ³ 0,110 ³³ END ³ 0,079 ³ 0,117 ³ ----- ³
³ F8 ³ 0,066 ³ 0,091 ³ 0,101 ³ 0,111 ³³ DOWN ³ 0,080 ³ 0,145 ³ ----- ³
³ F9 ³ 0,067 ³ 0,092 ³ 0,102 ³ 0,112 ³³ PgDn ³ 0,081 ³ 0,118 ³ ----- ³
³ F10 ³ 0,068 ³ 0,093 ³ 0,103 ³ 0,113 ³³ INS ³ 0,082 ³ 0,146 ³ ----- ³
³ F11 ³ 0,133 ³ 0,135 ³ 0,137 ³ 0,139 ³³ DEL ³ 0,083 ³ 0,147 ³ ----- ³
³ F12 ³ 0,134 ³ 0,136 ³ 0,138 ³ 0,140 ³³PrtScrn³ ----- ³ 0,114 ³ ----- ³
ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄ´³GREY / ³ 047 ³ 0,149 ³ 0,164 ³
³ TAB ³ 009 ³ 0,015 ³ 0,148 ³ 0,165 ³³GREY * ³ 042 ³ 0,150 ³ 0,055 ³
³BkSpc³ 008 ³ 008 ³ 127 ³ 0,014 ³³GREY - ³ 045 ³ 0,142 ³ 0,074 ³
³ ESC ³ 027 ³ 027 ³ 027 ³ 0,001 ³³GREY + ³ 043 ³ 0,144 ³ 0,078 ³
³ENTER³ 013 ³ 013 ³ 010 ³ 0,028 ³³GREY <Ù³ 013 ³ 010 ³ 0,166 ³
ÀÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÙÀÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÙ
ÚKEYÂÄ CTRL ÂÄ ALT Ä¿ ÚKEYÂ CTRLÂÄ ALT Ä¿ ÚKEYÂÄCTRLÂÄÄALTÄÄ¿
³ 1 ³ ----- ³ 0,120 ³ ³ ` ³ --- ³ 0,041 ³ ³ L ³ 012 ³ 0,038 ³
³ 2 ³ 0,003 ³ 0,121 ³ ³ \ ³ 028 ³ 0,043 ³ ³ M ³ 013 ³ 0,050 ³
³ 3 ³ ----- ³ 0,122 ³ ³ , ³ --- ³ 0,051 ³ ³ N ³ 014 ³ 0,049 ³
³ 4 ³ ----- ³ 0,123 ³ ³ . ³ --- ³ 0,052 ³ ³ O ³ 015 ³ 0,024 ³
³ 5 ³ ----- ³ 0,124 ³ ³ / ³ --- ³ 0,053 ³ ³ P ³ 016 ³ 0,025 ³
³ 6 ³ 030 ³ 0,125 ³ ³ A ³ 001 ³ 0,030 ³ ³ Q ³ 017 ³ 0,016 ³
³ 7 ³ ----- ³ 0,126 ³ ³ B ³ 002 ³ 0,048 ³ ³ R ³ 018 ³ 0,019 ³
³ 8 ³ ----- ³ 0,127 ³ ³ C ³ 003 ³ 0,046 ³ ³ S ³ 019 ³ 0,031 ³
³ 9 ³ ----- ³ 0,128 ³ ³ D ³ 004 ³ 0,032 ³ ³ T ³ 020 ³ 0,020 ³
³ 0 ³ ----- ³ 0,129 ³ ³ E ³ 005 ³ 0,018 ³ ³ U ³ 021 ³ 0,022 ³
³ - ³ 031 ³ 0,130 ³ ³ F ³ 006 ³ 0,033 ³ ³ V ³ 022 ³ 0,047 ³
³ = ³ ----- ³ 0,131 ³ ³ G ³ 007 ³ 0,034 ³ ³ W ³ 023 ³ 0,017 ³
³ [ ³ 027 ³ 0,026 ³ ³ H ³ 008 ³ 0,035 ³ ³ X ³ 024 ³ 0,045 ³
³ ] ³ 029 ³ 0,027 ³ ³ I ³ 009 ³ 0,023 ³ ³ Y ³ 025 ³ 0,021 ³
³ ; ³ ----- ³ 0,039 ³ ³ J ³ 010 ³ 0,036 ³ ³ Z ³ 026 ³ 0,044 ³
³ ' ³ ----- ³ 0,040 ³ ³ K ³ 011 ³ 0,037 ³ ÀÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÄÄÙ
ÀÄÄÄÁÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÙ ÀÄÄÄÁÄÄÄÄÄÁÄÄÄÄÄÄÄÙ
' PowerBASIC v3.0+
FUNCTION fGetKey$() LOCAL PUBLIC
WHILE NOT INSTAT : WEND
FUNCTION = INKEY$
END FUNCTION
' FirstBASIC and Older versions of PowerBASIC
FUNCTION fGetKey$() LOCAL PUBLIC
LOCAL G$, L%
DO
G$ = INKEY$
LOOP UNTIL LEN(G$) > 0
fGetKey$ = G$
END FUNCTION
'Q*BASIC
FUNCTION fGetKey$
DO
G$ = INKEY$
LOOP UNTIL LEN(G$) > 0
fGetKey$ = G$
END FUNCTION