May 17, 2024, 01:36:51 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


GetKey Problems

Started by Zen, January 31, 2006, 11:46:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zen

Hello. If i put a 1 as the parameter for GetKey it doesnt return the virtual code (i dont think) or at least i couldnt get it to work. It just returned the letter i pressed but in uppercase ???

Lewis

Ionic Wind Support Team

That would be the virtual key code. 

The list : (should look familiar)

Codes are OR'd together for things like the shift and control keys.

Paul.

Quote
Appendix C Virtual-Key Codes
The following table shows the symbolic constant names, hexadecimal values, and keyboard equivalents for the virtual-key codes used by the Microsoft Windows operating system. The codes are listed in numeric order.

Value (hexadecimal) Mouse or keyboard equivalent
01 Left mouse button
02 Right mouse button
03 Control-break processing
04 Middle mouse button (three-button mouse)
05-07 Undefined
08 BACKSPACE key
09 TAB key
0A-0B Undefined
0C CLEAR key
0D ENTER key
0E-0F Undefined
10 SHIFT key
11 CTRL key
12 ALT key
13 PAUSE key
14 CAPS LOCK key
15-19 Reserved for Kanji systems
1A Undefined
1B ESC key
1C-1F Reserved for Kanji systems
20 SPACEBAR
21 PAGE UP key
22 PAGE DOWN key
23 END key
24 HOME key
25 LEFT ARROW key
26 UP ARROW key
27 RIGHT ARROW key
28 DOWN ARROW key
29 SELECT key
2A Original equipment manufacturer (OEM) specific
2B EXECUTE key
2C PRINT SCREEN key for Windows 3.0 and later
2D INS key
2E DEL key
2F HELP key
30 0 key
31 1 key
32 2 key
33 3 key
34 4 key
35 5 key
36 6 key
37 7 key
38 8 key
39 9 key
3A-40 Undefined
41 A key
42 B key
43 C key
44 D key
45 E key
46 F key
47 G key
48 H key
49 I key
4A J key
4B K key
4C L key
4D M key
4E N key
4F O key
50 P key
51 Q key
52 R key
53 S key
54 T key
55 U key
56 V key
57 W key
58 X key
59 Y key
5A Z key
5B Left Windows key (Microsoft Natural Keyboard)
5C Right Windows key (Microsoft Natural Keyboard)
5D Applications key (Microsoft Natural Keyboard)
5E-5F Undefined
60 Numeric keypad 0 key
61 Numeric keypad 1 key
62 Numeric keypad 2 key
63 Numeric keypad 3 key
64 Numeric keypad 4 key
65 Numeric keypad 5 key
66 Numeric keypad 6 key
67 Numeric keypad 7 key
68 Numeric keypad 8 key
69 Numeric keypad 9 key
6A Multiply key
6B Add key
6C Separator key
6D Subtract key
6E Decimal key
6F Divide key
70 F1 key
71 F2 key
72 F3 key
73 F4 key
74 F5 key
75 F6 key
76 F7 key
77 F8 key
78 F9 key
79 F10 key
7A F11 key
7B F12 key
7C F13 key
7D F14 key
7E F15 key
7F F16 key
80H F17 key
81H F18 key
82H F19 key
83H F20 key
84H F21 key
85H F22 key
86H F23 key
87H F24 key
88-8F Unassigned
90 NUM LOCK key
91 SCROLL LOCK key
92-B9 Unassigned
BA-C0 OEM specific
C1-DA Unassigned
DB-E4 OEM specific
E5 Unassigned
E6 OEM specific
E7-E8 Unassigned
E9-F5 OEM specific
F6 Attn key
F7 CrSel key
F8 ExSel key
F9 Erase EOF key
FA Play key
FB Zoom key
FC Reserved for future use.
FD PA1 key
FE Clear key

Ionic Wind Support Team

Zen

thats what i thought, i assumed it would be the same as INKEY$ in IBasic. but a-z just prints out A-Z and nothing for return or backspace. same as the F keys, F1 starts at p and works its way along the alphabet and F12 prints a {

Im sure there must be something goin on.

Lewis

Zen

here is some exampel code to show you what i mean.

global sub main() {

int end = false;
string input = "";

do {

input = getkey(1);

if(input = "Q") { // Should be 51 not Q as it should return the virtual code

end = true;

} else {

writeln(input);

}

} until(end = true);

return 0;

}


Lewis

Ionic Wind Support Team

Q in ASCII  = 51.  You can't treat the return as a character when using the 'raw' method.  Use the ASC function.

Ionic Wind Support Team

Ionic Wind Support Team

You could also use

if input[0] = 51

If you don't want to use the ASCII funciton.
Ionic Wind Support Team

Zen

Thanks Paul. I will take a look tomorrow.

Lewis