Problems with Keydown()

Blitz3D Forums/Blitz3D Beginners Area/Problems with Keydown()

Ralf61(Posted 2003) [#1]
Does anyone have problems with Keydown()? My problem is, if i press a key for more than about 2 secs it seem to be locked, even if i release the key. keydown shows me that the key is still pressed. i can only release it, if i press the key again. this only happens under B3D not under "normal windows programs" or any other game. thx in forward!


jhocking(Posted 2003) [#2]
There are incompatibilites with DirectInput on some keyboards. Try adding "EnableDirectInput False" right after calling Graphics.


Ralf61(Posted 2003) [#3]
Thx for your replay, but this didn't help in my case. Any other idea?


jhocking(Posted 2003) [#4]
You should post some code. 99% of the time the problem is in your code.


Ralf61(Posted 2003) [#5]
I don't think so .. but please check:

Graphics3D 1024,768,16,1
EnableDirectInput true
SetBuffer BackBuffer()
color 255,255,255


While Not KeyDown( 1 )

cls

If KeyDown( 205 ) then text 0,0, "L"
If KeyDown( 203 ) then text 16,0, "R"
If KeyDown( 208 ) then text 32,0, "U"
If KeyDown( 200 ) then text 48,0, "D"

Flip

Wend

End

If i press any key for more than 2 secs and than release the key, the key is still shown as pressed. if i press the same key again, the key will show as released .. strange ...


LostCargo(Posted 2003) [#6]
it works fine for me. I have a ergonimic 'microsoft certified' keyboard.
but also i think you have all of your directions reversed. Code is a bit off.


Ralf61(Posted 2003) [#7]
My keyboard is an original Microsoft keyboard <sigh>. i dont think the problem is based on the keyboard, because this only happens under Blitz. code was only a sample for testing


semar(Posted 2003) [#8]
Try using the Flushkey command.


Gerry(Posted 2003) [#9]
i've never had probs, but i do recall concerns for keyboard buffers and the use of flushing in non-bb code so perhaps this is good advice, flush once a cycle or something suitable


jhocking(Posted 2003) [#10]
Forgive me for being redundant but are you sure you tried setting EnableDirectInput to False? In the code you posted you set it to True.