Skip to main content



      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 05:03 Go to next message
Eclipse UserFriend
Hi,

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 07:47 Go to previous message
Eclipse UserFriend
Hi,

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.

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


Current Time: Tue Jul 22 18:04:00 EDT 2025

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

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

Back to the top