Listing of inkey$ codes
Posted: Sun Oct 23, 2005 12:38 pm
can anyone list all the codes for inkey$?[/url][/code]
Discuss QBasic, Freebasic, QB64 and more
http://www.petesqbsite.com/phpBB3/
Code: Select all
KeyBoard Press List:
Esc = CHR$(27)
Enter = CHR$(13)
Tab = CHR$(9)
UpArrow = CHR$(0) + "H"
DownArrow = CHR$(0) + "P"
RightArrow = CHR$(0) + "M"
LeftArrow = CHR$(0) + "K"
F1 = CHR$(0) + ";"
F2 = CHR$(0) + "<"
F3 = CHR$(0) + "="
F4 = CHR$(0) + ">"
F5 = CHR$(0) + "?"
F6 = CHR$(0) + "@"
F7 = CHR$(0) + "A"
F8 = CHR$(0) + "B"
F9 = CHR$(0) + "C"
F10 = CHR$(0) + "D"
F11 = CHR$(0) + "?" * (OR: CHR$(0) + CHR(133) )
F12 = CHR$(0) + "?" ** (OR: CHR$(0) + CHR(134) )
Insert = CHR$(0) + "R"
Home = CHR$(0) + "G"
Delete = CHR$(0) + "S"
PageUp = CHR$(0) + "I"
PageDown = CHR$(0) + "Q"
* Hold 'Alt' and type "1 3 3" to get '?'
** Hold 'Alt' and type "1 3 4" to get '?'
These are the same as the CHR$() number codes in the ASCII chart.
Holding 'Alt' while typing in the code number gives you any of the
weird looking symbols in your code.
'End of List...
Code: Select all
UpKey$ = CHR$(0) + CHR$(72)
DownKey$ = CHR$(0) + CHR$(80)
LeftKey$ = CHR$(0) + CHR$(75)
RightKey$ = CHR$(0) + CHR$(77)
EscKey$ = CHR$(27)
SpaceKey$ = " "
PageUp$ = CHR$(0) + CHR$(73)
PageDown$ = CHR$(0) + CHR$(81)
HomeKey$ = CHR$(0) + CHR$(71)
EndKey$ = CHR$(0) + CHR$(79)
InsKey$ = CHR$(0) + CHR$(82)
DelKey$ = CHR$(0) + CHR$(83)
EnterKey$ = CHR$(13)
TabKey$ = CHR$(9)
sTabKey$ = CHR$(0) + CHR$(15)
cHomekey$ = CHR$(0) + CHR$(119)
cEndKey$ = CHR$(0) + CHR$(117)
cPrtSc$ = CHR$(0) + CHR$(114)
cLeftKey$ = CHR$(0) + CHR$(115)
cRightKey$ = CHR$(0) + CHR$(116)
cPageDown$ = CHR$(0) + CHR$(118)
cPageUp$ = CHR$(0) + CHR$(132)
F1Key$ = CHR$(0) + CHR$(59)
F2Key$ = CHR$(0) + CHR$(60)
F3Key$ = CHR$(0) + CHR$(61)
F4Key$ = CHR$(0) + CHR$(62)
F5Key$ = CHR$(0) + CHR$(63)
F6Key$ = CHR$(0) + CHR$(64)
F7Key$ = CHR$(0) + CHR$(65)
F8Key$ = CHR$(0) + CHR$(66)
F9Key$ = CHR$(0) + CHR$(67)
F10Key$ = CHR$(0) + CHR$(68)
F11Key$ = CHR$(0) + CHR$(133)
Code: Select all
'include:'keys.bas'
Very nice, Nath.Nathan1993 wrote:I have me own little cheat sheet...
.....
Matt, At first your idea of writing a program sounds ok, but after thinking about it, you still have to manually add the names of the keys to the generated list. Example: How else can you identify the chr$(81) key as being Page Down?matt2jones wrote:What you should do is write a program that prints the ascii codes and characters of any key you INKEY$, then you can work out a list for yourself.
.....
wait, I get what you were saying...moneo wrote:Very nice, Nath.Nathan1993 wrote:I have me own little cheat sheet...
.....
Sometimes you really amaze me.
*****
Is it just me, or are you trying to inspire sympathy?Nathan1993 wrote:wait, I get what you were saying...moneo wrote:Very nice, Nath.Nathan1993 wrote:I have me own little cheat sheet...
.....
Sometimes you really amaze me.
*****
YOU THINK IM DUMB!!!
well, I kinda am... but I am going through a bad self-esteem time...
Code: Select all
do :A$ = right$(inkey$,1):print A$,asc(A$):loop until A$ = chr$(27)
Nath, I don't think you're dumb. It's just that you're overly eager. You post all over the place and most of the time it has nothing whatsoever to do with the topic. You just want to get your 2 cents in.Nathan1993 wrote:.....
wait, I get what you were saying...
YOU THINK IM DUMB!!!
well, I kinda am... but I am going through a bad self-esteem time...
Matt, a very good point.matt2jones wrote: PS: When your making cos and sin look up tables do you copy and past in a list of 720
C!(0) = 1:S!(0) = 0....
Or do you type in the formula and get the computer to work it out for you?
Show me how to do that effectivly with ASCII input for the user.... Other wise I myself look up on a list when I need one I havn't yet remembered.... ..matt2jones wrote: PS: When your making cos and sin look up tables do you copy and past in a list of 720
C!(0) = 1:S!(0) = 0....
Or do you type in the formula and get the computer to work it out for you?
He just did show you..matt2jones wrote:Code: Select all
do :A$ = right$(inkey$,1):print A$,asc(A$):loop until A$ = chr$(27)
Matt, just for the record, the little program you posted above does not work. Before hitting a key, it issues an "illegal function call". I don't think you can do the whole program on one line of code because you need to wait after the inkey$ to detect getting a character.matt2jones wrote:Then press whatever key you want to know the info about, and it prints it.Code: Select all
do :A$ = right$(inkey$,1):print A$,asc(A$):loop until A$ = chr$(27)
I have a line like that in the immediate window pretty much every time I open QB since I started. It's how I know that the F1-5 keys are ; < = > @, I could never find those in the tables in the help file.
.....
Code: Select all
F1 is ; 59 dec 3B hex
F2 is < 60 dec 3C hex
F3 is = 61 dec 3D hex
F4 is > 62 dec 3E hex
F5 is ? 63 dec 3F hex
Very clever.Kylemc wrote:there should be a sleep: after the do:.
Code: Select all
do:do:A$ = right$(inkey$,1):loop while A$ = "":print A$,ASC(A$):loop until a$ = chr$(27)
Ironicly, I have been using similar constants for the past couple of months since I started coding most projects in FB, so it just helps to prove my point that you don't know these things properly if you rely on tables like the above.F1 = CHR$(0) + ";"
F2 = CHR$(0) + "<"
F3 = CHR$(0) + "="
F4 = CHR$(0) + ">"
F5 = CHR$(0) + "?"
F6 = CHR$(0) + "@"
F7 = CHR$(0) + "A"
F8 = CHR$(0) + "B"
F9 = CHR$(0) + "C"
F10 = CHR$(0) + "D"
F11 = CHR$(0) + "?" * (OR: CHR$(0) + CHR(133) )
F12 = CHR$(0) + "?" ** (OR: CHR$(0) + CHR(134) )