Page 1 of 2

Listing of inkey$ codes

Posted: Sun Oct 23, 2005 12:38 pm
by qbfreak2000
can anyone list all the codes for inkey$?[/url][/code]

Posted: Sun Oct 23, 2005 12:47 pm
by MystikShadows
your QB online help has all that information...go to it and look up keyboard SCAN Codes in the Help/Contents ...

Posted: Sun Oct 23, 2005 3:23 pm
by Rattrapmax6
http://www.petesqbsite.com/sections/tut ... amming.txt

/\ There is a list I made up awhile ago that uses INKEY$... :wink:

Edit: Or here is just the list w/o the tutorial on how to use them:

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...
:wink:

Posted: Sun Oct 23, 2005 4:45 pm
by {Nathan}
I have me own little cheat sheet...

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)
1> take that code and put it into keys.bas.
2> at the beginning of your program, put the line:

Code: Select all

'include:'keys.bas'
3> Now, just use the strings (such as Upkey$) instead of the codes.

Posted: Sun Oct 23, 2005 8:52 pm
by moneo
Nathan1993 wrote:I have me own little cheat sheet...
.....
Very nice, Nath.
Sometimes you really amaze me. :wink:
*****

Posted: Mon Oct 24, 2005 3:22 am
by matt2jones
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.

Asking for lists (explicitly) other people have made themselves is lazy and results in a lack of experiance in solving problems by yourself. Next time you want a resource you should think about what you could do to make it for yourself:

like, if you want a sprite editor next, instead of asking for one someone else has written, think about how you could write one, and if you don't have enough knowlage to do so, pinpoint exactly what you need to know so that you can write it (eg. Maybe you don't know how to save/load sprites to a file, or you haven't used arrays yet, or how to reduce the flicker when you re-draw the screen).

Either way you will eventually develope the same skills, but unless you seriously tackle the problem yourself first it will take you ages to become competant and self-sufficiant at solving any programming problems you have by yourself, which is the ultimate goal.

matt

Posted: Mon Oct 24, 2005 2:28 pm
by {Nathan}
Moneo: thanks, but that was from a tutorial... I just remembered it.

Matt: screw you! cheat sheets rule. You dont see people doing that in school, now do ya?

Posted: Mon Oct 24, 2005 6:18 pm
by moneo
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.
.....
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?

I usually just refer to the Keyboard Scan Code Table in my manual. That's the best "cheat sheet" that I know.
*****

Posted: Mon Oct 24, 2005 7:47 pm
by {Nathan}
moneo wrote:
Nathan1993 wrote:I have me own little cheat sheet...
.....
Very nice, Nath.
Sometimes you really amaze me. :wink:
*****
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...

Posted: Mon Oct 24, 2005 9:27 pm
by The Awakened
Nathan1993 wrote:
moneo wrote:
Nathan1993 wrote:I have me own little cheat sheet...
.....
Very nice, Nath.
Sometimes you really amaze me. :wink:
*****
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...
Is it just me, or are you trying to inspire sympathy?

The only pity you'll get from me is the fact that you're dumb enough to say "screw you" to m2j.

Posted: Tue Oct 25, 2005 3:55 am
by matt2jones

Code: Select all

do :A$ = right$(inkey$,1):print A$,asc(A$):loop until A$ = chr$(27)

Then press whatever key you want to know the info about, and it prints it.

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.

On the argument of cheat sheets:

Lets pretend (for whatever reason) you no-longer have access to your cheat sheets. Unless you've learned them off by heart (which I am not about to do), you can't do anything.

But if you know the FORMULA to generate the answers, then you can find out all the information you need to know.

The only reason humans are more used to using reference sheets and log tables is because traditionally it was easier to have someone else work out the computations.

Luckily I have a computer working for me.

matt

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?

Posted: Tue Oct 25, 2005 2:16 pm
by moneo
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...
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.

Once in a while you actually make a contribution to the topic, and I try to acknowledge your effort.

Your remark directed at Matt was totally uncalled for. It's ok to disagree, but insults will not help to make your case. They just make you look bad.
*****

Posted: Tue Oct 25, 2005 5:05 pm
by Kyle
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?
Matt, a very good point. :)

Posted: Tue Oct 25, 2005 5:57 pm
by Rattrapmax6
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.... :roll: ..

BTW, my list is missing 1:

Backspace = CHR$(8)

:wink:

Posted: Wed Oct 26, 2005 3:59 am
by Kyle
matt2jones wrote:

Code: Select all

do :A$ = right$(inkey$,1):print A$,asc(A$):loop until A$ = chr$(27)
He just did show you..

Posted: Wed Oct 26, 2005 8:54 am
by matt2jones
Obviously (and I shouldn't have to say this, but I feel this conversation going that way) I do not have a program that writes out a file of constants with english string names for every key on the keyboard.

If you intend proving this to me through rhetorical questioning I won't play along.

I wasn't talking about a file of constants, I was talking with regards to a table, like in the QB help files.

If you look closely you will see that what was asked for was not a file declaring constants, but a table, two subtly different things. I was objecting to someone looking for a table, not someone looking for a file full of #defines. I have no objections to said files, and have not refered to them, or your post at all throughout the proceedings.

I, along with the rest of the world, use said files with a clear concience. That is not what I am arguing about.

Repeat:

I am not trying to diss/convert you or your way of life. We are on the same side.

matt - legal bullshitter

Posted: Wed Oct 26, 2005 2:14 pm
by moneo
matt2jones wrote:

Code: Select all

do :A$ = right$(inkey$,1):print A$,asc(A$):loop until A$ = chr$(27)
Then press whatever key you want to know the info about, and it prints it.

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.
.....
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.

And BTW, the characters for F1 to F5, after the chr$(0), are:

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
You probably didn't find them in the Scan Code Table because they chose to represent them in hex.
*****

Posted: Wed Oct 26, 2005 2:22 pm
by Kyle
there should be a sleep: after the do:.

Posted: Wed Oct 26, 2005 7:03 pm
by moneo
Kylemc wrote:there should be a sleep: after the do:.
Very clever. :o
The SLEEP with no parameter waits for a key press, which in turn satisfies the successive code which needs a key press.
*****

Posted: Thu Oct 27, 2005 4:18 am
by matt2jones
All apologies.

Code: Select all

do:do:A$ = right$(inkey$,1):loop while A$ = "":print A$,ASC(A$):loop until a$ = chr$(27)
But really, if you couldn't have figured that out, don't go acusing me of 'not being able to use the scancode tables'. This is the 'question and answers' section, if you wanna insult me, have the decency to PM me or something.

I was trying to demonstrate knowing something by heart, if I was looking up reference sheets for the codes I would have scrolled down to where ever I saw:
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) )
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.

All I'm trying to say is it's better to know how to work out an answer then to have a load of answers written infront of you and keep copying them off.

matt

Greeks had brilliant mathematicians, who figured shit out (knew the formula). Romans had great engineers, who just got things done and didn't really care about how they were doing it (looked up tables).

Greeks gave us democracy, Romans gave us facism.