Scancode trouble

Blitz3D Forums/Blitz3D Programming/Scancode trouble

Mr.Waterlily(Posted 2004) [#1]
I have big trouble getting the scancode of the "Alt Gr" button.
When I run this little program:
Repeat
   For testkey = 1 To 221
      If KeyHit(testkey)
         Print testkey
      End If
   Next
Forever

I get TWO scancodes for the "Alt Gr" button, 29 and 184.
And they come in no particular order.
Since 29 is the code for "Left Ctrl" there is clearly something wrong. Has anyone else got this problem?

Is this an issue with Blitz or my keyboard or something else?


David819(Posted 2004) [#2]
I think it has something to do with the coding, i remember seeing some code on how to get the scancode of a key, i'll see if i can find it for you.


David819(Posted 2004) [#3]
I found the code but it is for darkbasic using the scancode command, so i'm not sure why it does that but i shall keep looking of an answere.


Mr.Waterlily(Posted 2004) [#4]
What does that darkbasic code do?
My code above gets the correct scancode of every button on the keyboard except for "Alt Gr".
Am I doing something wrong?


koekjesbaby(Posted 2004) [#5]
nothing, blitz just thinks alt gr is ctrl + alt (29 = left ctrl, 184 = right alt). i guess you just have to live with it ;)


Mr.Waterlily(Posted 2004) [#6]
Hmmmm, I guess so.
But how can I detect if a user has pressed alt gr then?
Some kind of workaround?


David819(Posted 2004) [#7]
just use : if keyhit(184) then ...
it will only do what you want it 2 when you press Alt Gr.


big10p(Posted 2004) [#8]
I think blitz has 'issues' with correctly reading the keyboard. I had a nightmare trying to get the right SHIFT key to work consistantly. Sometimes it'd work - sometimes it wouldn't. :/


Mr.Waterlily(Posted 2004) [#9]
I discovered the same issue with the 3 "windowsbuttons".
And the all have "left shift" first, and then their own code.
But not all keyboards have this problem. Strange.
I hope this will be fixed in a future release of blitz.


PowerPC603(Posted 2004) [#10]
I'm having the same problem with the ALT GR key.

I also have the problem when using the arrow-keys.
When I press the UP-arrow, then the above program prints 42 and 200.

Also for the other three arrows, the value 42 is always there.


Mr.Waterlily(Posted 2004) [#11]
I assume that the problem has to do with different keyboards, since it differs so much between them.
But is it Blitz that canīt handle them or is it a windows issue?
Maybe the keyboard-handler in Blitz should be investigated by Mark?