Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » KeyListeners and pressing two keys at the same time
KeyListeners and pressing two keys at the same time [message #441218] Thu, 12 August 2004 13:05 Go to next message
Sami Lakka is currently offline Sami LakkaFriend
Messages: 47
Registered: July 2009
Member
I have a program that requires quite fast Keyboard handling and while
porting the keyboard
handling routines to SWT I noticed that I lose KeyReleased event when I
press two buttons at the same time.
For example, if I press first A and then W, I get notified that both of the
keys are pressed, but when I release the keys
only the last key (W) gets the KeyReleased event. How can I fix this error?
I use swt-win32-3054.
Re: KeyListeners and pressing two keys at the same time [message #441233 is a reply to message #441218] Thu, 12 August 2004 15:58 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
https://bugs.eclipse.org/bugs/show_bug.cgi?id=50020

"Sami Lakka" <sami.lakka@tut.fi> wrote in message
news:cffppf$fem$1@eclipse.org...
> I have a program that requires quite fast Keyboard handling and while
> porting the keyboard
> handling routines to SWT I noticed that I lose KeyReleased event when I
> press two buttons at the same time.
> For example, if I press first A and then W, I get notified that both of
the
> keys are pressed, but when I release the keys
> only the last key (W) gets the KeyReleased event. How can I fix this
error?
> I use swt-win32-3054.
>
>
>
Re: KeyListeners and pressing two keys at the same time [message #441346 is a reply to message #441233] Fri, 13 August 2004 07:52 Go to previous messageGo to next message
Sami Lakka is currently offline Sami LakkaFriend
Messages: 47
Registered: July 2009
Member
So basically the only way to go around this bug is to give the keys
a "lifetime", that gets updated every time key is pressed. If key is
not pressed the Listener has to assume it was released? Are there
any better suggestions?



"Steve Northover" <steve_northover@ca.ibm.com> kirjoitti viestiss
Re: KeyListeners and pressing two keys at the same time [message #441400 is a reply to message #441346] Fri, 13 August 2004 16:48 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Do you really need to perform an action on keyReleased? Why not do it on
keyPressed?

"Sami Lakka" <sami.lakka@tut.fi> wrote in message
news:cfhrrd$bpt$1@eclipse.org...
> So basically the only way to go around this bug is to give the keys
> a "lifetime", that gets updated every time key is pressed. If key is
> not pressed the Listener has to assume it was released? Are there
> any better suggestions?
>
>
>
> "Steve Northover" <steve_northover@ca.ibm.com> kirjoitti viestiss
Re: KeyListeners and pressing two keys at the same time [message #441416 is a reply to message #441400] Sat, 14 August 2004 08:56 Go to previous messageGo to next message
Sami Lakka is currently offline Sami LakkaFriend
Messages: 47
Registered: July 2009
Member
Basically because I'm developing 3D application where user can walk
in the 3D world. When the key is pressed the camera moves forward,
when the key is released the camera stops. The application uses an existing
library that queries the keyboard status rapidly so I save the key status
to an boolean array. When key is pressed the array returns true, otherwise
false. So currently the keys get stuck and the camera moves to random
direction because I don't get the keyReleased - event.



"Steve Northover" <steve_northover@ca.ibm.com> kirjoitti viestiss
Re: KeyListeners and pressing two keys at the same time [message #441513 is a reply to message #441416] Mon, 16 August 2004 17:03 Go to previous message
Douglas Pollock is currently offline Douglas PollockFriend
Messages: 84
Registered: July 2009
Member
Sami Lakka wrote:
> Basically because I'm developing 3D application where user can walk
> in the 3D world. When the key is pressed the camera moves forward,
> when the key is released the camera stops. The application uses an
> existing library that queries the keyboard status rapidly so I save the
> key status to an boolean array. When key is pressed the array returns
> true, otherwise false. So currently the keys get stuck and the camera
> moves to random direction because I don't get the keyReleased - event.

The keyReleased event is wholly unreliable in SWT. You can lose the
keyReleased event for the reasons mentioned in the bug, as well as others
(focus and activation events, for example). I don't think you can write
this kind of application using SWT.



sorry,
d.
Previous Topic:Is it possible to change Font weight?
Next Topic:Cannot change background of Button ?
Goto Forum:
  


Current Time: Wed Sep 25 06:46:20 GMT 2024

Powered by FUDForum. Page generated in 0.03503 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top