Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » How to determine if a key is down or up? (Aside from system keys)
How to determine if a key is down or up? (Aside from system keys) [message #12047] Tue, 09 October 2007 16:13 Go to next message
ulrich is currently offline  ulrich
Messages: 3
Registered: September 2007
Junior Member
I need to detect whether a given key is up/down - how can I do this?

I noticed that for system keys like Ctrl/Spacebar/etc a key event gets sent once when it is pressed and a second time OR'd with K_KEYUP, when it is released. However this is not the case for other basic keys (e.g. a-z, etc).

Thanks in advance,
Luke
Re: How to determine if a key is down or up? (Aside from system keys) [message #12050 is a reply to message #12047] Tue, 09 October 2007 17:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
ulrich wrote on Tue, 09 October 2007 10:13

I need to detect whether a given key is up/down - how can I do this?

I noticed that for system keys like Ctrl/Spacebar/etc a key event gets sent once when it is pressed and a second time OR'd with K_KEYUP, when it is released. However this is not the case for other basic keys (e.g. a-z, etc).

Thanks in advance,
Luke


Actually, it is case for them too. They are comming twice, once as K_A, second time as 'a'. There is then K_KEYUP|K_A (but not K_KEYUP|'a').
Re: How to determine if a key is down or up? (Aside from system keys) [message #12061 is a reply to message #12050] Tue, 09 October 2007 22:41 Go to previous messageGo to next message
ulrich is currently offline  ulrich
Messages: 3
Registered: September 2007
Junior Member
I put a printf inside the overrided Key function to show which key was pressed and the keycode triggered by the event.

On my Linux box, only system keys have up/down events fired when a key is pressed. From your suggestion - I wondered if it was an OS issue. I tried the same thing on my WinXP box and sure enough, all the keys received up/down events.

Any idea how to get this to work under Linux?
Re: How to determine if a key is down or up? (Aside from system keys) [message #12064 is a reply to message #12061] Tue, 09 October 2007 23:37 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
ulrich wrote on Tue, 09 October 2007 16:41

I put a printf inside the overrided Key function to show which key was pressed and the keycode triggered by the event.

On my Linux box, only system keys have up/down events fired when a key is pressed. From your suggestion - I wondered if it was an OS issue. I tried the same thing on my WinXP box and sure enough, all the keys received up/down events.

Any idea how to get this to work under Linux?


Well, might be a bug/"underdevelopment" (or perhaps it is not just possible in linux). Could zip and post your testing package please? (if only to speedup investigation process).

Mirek
Previous Topic: Drag & Drop example or documentation?
Next Topic: LOG_DBG does not work correctly [BUG]
Goto Forum:
  


Current Time: Thu Mar 28 15:13:04 CET 2024

Total time taken to generate the page: 0.02223 seconds