A Key responds to two different keydown requests

Archives Forums/BlitzMax Bug Reports/A Key responds to two different keydown requests

Klin(Posted 2011) [#1]
Hello,
for the first: I use a german keyboard!
I tried today to request ONLY the left control key. I used this code:
...
If(KeyDown(KEY_LCONTROL)) Then
    Print("Pressed!")
EndIF
...


It works... But the problem is when I press the Right Alt key, BlitzMax print "Pressed!" too! :/

Then I tried this:
Graphics 200,200
Local key:Int
While Not KeyHit(KEY_ESCAPE)
	If KeyDown(KEY_LCONTROL) And KeyDown(KEY_RALT) Then Print "Test"
	Key = GetChar()
	If key<>0 Then Print key
Wend

I started and pressed ONLY the RIGHT ALT key. The console said this:
Executing:untitled2.exe
Test
Test
Test
Test
...


Info:
Operation System: Windows 7 32 Bit Ultimate
Keyboard: German (QWERTZ)
BMax Version: 1.41

sry for bad english.

THX
Klin

Last edited 2011


Zeke(Posted 2011) [#2]
http://en.wikipedia.org/wiki/AltGr_key

so its not bug. AltGr = Control+Alt (Left Control+Alt)

use this to check only Left Control:
Graphics 200,200
Local key:Int
While Not KeyHit(KEY_ESCAPE)
	Cls
	If KeyDown(KEY_LCONTROL) Then DrawText "Left Control or RAlt(AltGr)" , 0,0

	If KeyDown(KEY_LCONTROL) And Not KeyDown(KEY_RALT) Then DrawText "LControl only",0,20

	Key = GetChar()
	If key <> 0 Then DrawText "key: " + key , 10 , 30
	Flip
Wend


Last edited 2011