Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Shift key question?

Author
Message
xix psycho xix
15
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 23rd Feb 2012 19:01
It seems that the behavior for the shift key is that when the shift key is pressed with another key, dbScanCode () returns the scan code of the key that is NOT the shift key. So if I was pressing shift+a the scancode would be 30. This works with the right shift key as near as I can tell all the time, but when using the LEFT shift key and pressing any of the keys ",./" which in uppercase is "<>?" the scancode returned is the scancode of the left shift key. This is screwing up my GUI code!!! Has anyone else had the same problem?
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 23rd Feb 2012 22:42
Is this for text editing? If so, don't use dbScanCode(), use dbGetEntry(). This will get any key combinations that are pressed. I use it in my GUI. There are a few keys that don't work using this, such as [DEL], [BACKSPACE], [INSERT] and [ENTER], but you can make an exception for those.

The fastest code is the code never written.
xix psycho xix
15
Years of Service
User Offline
Joined: 15th Sep 2008
Location:
Posted: 23rd Feb 2012 22:49
It is for text editing, but rather than use dbEntry$ I made a character map:



I just liked this approach better. It works really well, just not for those three keys if holding left shift. Again, works fine with right shift, but not with left shift...
Jonas
18
Years of Service
User Offline
Joined: 10th Aug 2005
Location: What day is it?
Posted: 27th Feb 2012 16:57
Scan codes are returned in priority order so your left shift is a higher priority than those 3 keys. As a matter of fact, my entire bottom row of keys is trumped by my left shift as well as some other keys. Afraid you'll need to go with Hawkblood's method. Also, dbKeyState will see multiple keys being pressed simultaneously. I always use it to get the state of the arrow keys so I can do things like press up and right at the same time without any conflicts. Might be worth a look. Good luck.

Login to post a reply

Server time is: 2024-04-19 05:53:59
Your offset time is: 2024-04-19 05:53:59