Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TAB as global shortcut key
TAB as global shortcut key [message #737817] Sat, 15 October 2011 09:47 Go to next message
Eclipse UserFriend
Hi,

I use a filter on my Display instance to capture global shortcuts.
It works fine in general, but if in case of TAB it seems that I have to
add the following TraverseListener to all of my widgets to prevent these widgets from consuming the TAB event:

<CONTROL>.addTraverseListener(
new TraverseListener() {
  @Override
  public void keyTraversed(TraverseEvent e) {
    e.doit = false;
  }
});



Is there a more elegant way to use TAB as a global shortcut?




Re: TAB as global shortcut key [message #739647 is a reply to message #737817] Mon, 17 October 2011 13:40 Go to previous message
Eclipse UserFriend
Why not use a filter for the SWT.Traverse event too, instead of adding the TraverseListener to every control?
You can use the detail field if you want to capture only TAB traversal events.
For example:
display.addFilter(SWT.Traverse, new Listener() {
      public void handleEvent(Event event) {
         if (event.detail == SWT.TRAVERSE_TAB_NEXT || event.detail ==SWT.TRAVERSE_TAB_PREVIOUS){
                 event.doit = false;
	     }
         }
});
Previous Topic:Custom Tree Selection mechanism
Next Topic:OS X: launcher inside .app
Goto Forum:
  


Current Time: Wed Jul 23 14:39:19 EDT 2025

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

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

Back to the top