Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Keyboard Events
Keyboard Events [message #879865] Fri, 01 June 2012 02:14 Go to next message
Christopher Riley is currently offline Christopher RileyFriend
Messages: 9
Registered: March 2012
Junior Member
I've been having trouble obtaining keyboard focus for my SWT widgets, nothing seems to be able to setFocus() and all requests for the focus owner are returning null.

I've also tried using the keybinding commands in e4, which work occassionally, but keyboard focus seems to be grabbed by some mystery force within the swt frame when i click on it, and I can never get focus back for the keybindings to work again.

All that I really need is a solution that will pick up all keypress events for my application and print out that the keys have been pressed. Does anyone know a simple way of doing this in e4? Possibly a global keybinding context that I can use?

There are some intricacies of my UI that may make obtaining focus tricky for some of the more deeply nested components, but I'm unable to even request focus for my top level shell or display.

Any help would be greatly appreciated! Thanks!

~Christopher Riley
Re: Keyboard Events [message #880048 is a reply to message #879865] Fri, 01 June 2012 10:37 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 242
Registered: July 2009
Senior Member
Use SWT Display filters.

Make sure you're providing a @Focus method that does more thn set the focus on the *provided* Composite -- you have to set the fous to a widget that *your* part created (though that can be a composite).
Re: Keyboard Events [message #880060 is a reply to message #879865] Fri, 01 June 2012 10:49 Go to previous message
Sopot Cela is currently offline Sopot CelaFriend
Messages: 597
Registered: December 2010
Senior Member

Also try to use forceFocus() if setFocus() doesn't work. This bug may be relevant
Previous Topic:e4 compatibility: PerspectiveRegistry.clonePerspective
Next Topic:MDirtyable usage
Goto Forum:

Current Time: Thu Jun 21 21:53:57 GMT 2018

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

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

Back to the top