Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Same accelerator key for multiple SWT widgets(Accelerator keys for SWT widgets)
icon5.gif  Same accelerator key for multiple SWT widgets [message #649228] Tue, 18 January 2011 10:03 Go to next message
Mustufa Kasidwala is currently offline Mustufa KasidwalaFriend
Messages: 60
Registered: July 2009

When we attach same accelerator keys to multiple SWT widgets, what is the expected behaviour? the key will work only for one widget? What I have experienced in past with other windows applications is that the focus will toggle to all the widgets one by one when the user presses this key. Consider below scenario:

There are two text widgets with labels 'Name' and 'Address', I assign 'A' as the accelerator key for both these labels and hence pressing 'Alt+A' should focus one of the text widgets.

My problem is, I have a screen with many SWT widgets and the accelerator key is same for some widgets. What I expected was the toggle behaviour as mentioned above, but that's not happening. Pressing the accelerator key just moves the focus on one of the widgets and stays there even after multiple same key presses.

Is there a solution to this?

Thanks and Regards

Mustafa Kasidwala
Re: Same accelerator key for multiple SWT widgets [message #649484 is a reply to message #649228] Wed, 19 January 2011 12:47 Go to previous message
Lakshmi P ShanmugamFriend
Messages: 277
Registered: July 2009
Location: India
Senior Member

SWT doesn't support toggling between widgets when the same mnemonic is set for multiple widgets in the same shell. When a accelerator key is pressed, SWT looks for a match in the Shell's widgets and stops when it finds the first match.

However you can emulate the toggling behavior by listening to the SWT.Traverse event and checking the event.detail field for SWT.TRAVERSE_MNEMONIC. You should set the event.doit field = false when you want the focus to move to the next matching widget.


Lakshmi P Shanmugam
Previous Topic:Text Viewer with pagination - the way to go?
Next Topic:Drawing gradients
Goto Forum:

Current Time: Thu Jan 28 00:26:03 GMT 2021

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

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

Back to the top