Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Keyboard Events
Keyboard Events [message #879865] Thu, 31 May 2012 22:14 Go to next message
Christopher Riley is currently offline Christopher Riley
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 06:37 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
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 06:49 Go to previous message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

Also try to use forceFocus() if setFocus() doesn't work. This bug may be relevant
https://bugs.eclipse.org/bugs/show_bug.cgi?id=379024
Previous Topic:e4 compatibility: PerspectiveRegistry.clonePerspective
Next Topic:MDirtyable usage
Goto Forum:
  


Current Time: Wed Aug 20 12:53:50 EDT 2014

Powered by FUDForum. Page generated in 0.01532 seconds