Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » TAB as global shortcut key
TAB as global shortcut key [message #737817] Sat, 15 October 2011 13:47 Go to next message
andzsinszan is currently offline andzsinszanFriend
Messages: 32
Registered: August 2011

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:

new TraverseListener() {
  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 17:40 Go to previous message
Lakshmi ShanmugamFriend
Messages: 275
Registered: July 2009
Location: India
Senior Member
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;

Lakshmi P Shanmugam
Previous Topic:Custom Tree Selection mechanism
Next Topic:OS X: launcher inside .app
Goto Forum:

Current Time: Tue Jun 19 05:19:11 GMT 2018

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

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

Back to the top