KeyDown Problem!!!
Blitz3D Forums/Blitz3D Programming/KeyDown Problem!!!
| ||
Hi there, I am making a little Gui for my needs and I want to make an edit box which repeat the keys when they are maintained down. So I ve decided to use the Blitz Keydown function but I need to combine all the keys with the Shift one to make upper chars. The problem is it don't work with all keys and apparently those which scancodes are above the shift scancode. let's see: ------ Graphics3D 640, 480, 16, 2 SetBuffer GraphicsBuffer() While Not KeyDown(1) Cls result = 0 For n = 1 To 127 k = KeyDown(n) If k Then result = n : Exit Next Text 10, 10, result Flip Wend ------- In this example I first press shift (sc = 42) then I combine with another one that modify the scancode. What I ve constated on my computer is when I combine Shift with a key that have an upper scancode, the scancode stay at 42. So, is there a way or maybe a dll that i could use to avoid this problem thanks, köchOn |
| ||
I believe there is an 'include' in the archives. It is possibly somewhere in one of the demos that come with B3D - I think it caters for all combinations - including punctuation. EDIT: I got that wrong - "Krylar" designed it but it doesn't differentuate between upper and lower case. |
| ||
Have a look at this one: http://www.blitzbasic.com/codearcs/codearcs.php?code=243 There are lots of input routines and stuff in here: http://www.blitzbasic.com/codearcs/codearcs.php?cat=5 |
| ||
Thanks Puki, it may help but as it use KeyHit, it not handle key repetition... |
| ||
Mine does: http://www.blitzbasic.com/codearcs/codearcs.php?code=251 |
| ||
What I ve constated on my computer is when I combine Shift with a key that have an upper scancode, the scancode stay at 42. That's because the scancode for shift is 42 and your loop is only finding one scancode! |
| ||
Use AsyncKeyState() |
| ||
Hi Octothorpe, This is exactly what I was looking for Great code, Thanks to all. |