Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » accelerator keys / hotkeys
accelerator keys / hotkeys [message #452157] Mon, 14 March 2005 16:53 Go to next message
Michael Pellaton is currently offline Michael PellatonFriend
Messages: 289
Registered: July 2009
Senior Member
Hi

I would like to reach every component that takes user input on an SWT
GUI (RCP application) using hotkeys/accelerator keys. So far, I managed
to implement this using Button, Label and Group objects ("&" in the text
property). However, I'd like to reach Text, Combo an Table objects
aswell using keys different than "tabbing" the cursor through the whole
tab order until the cursor is on the desired component.

Can this be done in an easy way?
.... or do I have to implement listeners that control the focus?

If the listener-solution is the way to go, how would you design focus
control of an entire GUI so that EVERY UI component is accessed using
the same mechanisms?

Thanks for your help in advance!

Michael Pellaton
Re: accelerator keys / hotkeys [message #452312 is a reply to message #452157] Thu, 17 March 2005 14:10 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Michael,

If I understand your question correctly, you can use Display.addFilter(...)
to hook a listener that will be notified of all events of a specified type,
regardless of the target widget. So if you listenened for SWT.KeyDown then
you could look at each keystroke and if you detect a magic "move-to-x"
keypress then you could change the focus accordingly. Note that you would
also probably want to set the event's doit field to false in the case of
interpreting it as a traversal so that it would not also be processed as a
normal KeyDown in the original target widget.

Grant

"Michael Pellaton" <newsgroups@pellaton.li> wrote in message
news:d14fik$nem$1@www.eclipse.org...
> Hi
>
> I would like to reach every component that takes user input on an SWT
> GUI (RCP application) using hotkeys/accelerator keys. So far, I managed
> to implement this using Button, Label and Group objects ("&" in the text
> property). However, I'd like to reach Text, Combo an Table objects
> aswell using keys different than "tabbing" the cursor through the whole
> tab order until the cursor is on the desired component.
>
> Can this be done in an easy way?
> ... or do I have to implement listeners that control the focus?
>
> If the listener-solution is the way to go, how would you design focus
> control of an entire GUI so that EVERY UI component is accessed using
> the same mechanisms?
>
> Thanks for your help in advance!
>
> Michael Pellaton
Re: accelerator keys / hotkeys [message #452351 is a reply to message #452312] Thu, 17 March 2005 17:40 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
You can also define an accelerator for a Menu:

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet29.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup


"Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
news:d1c357$nms$1@www.eclipse.org...
> Michael,
>
> If I understand your question correctly, you can use
> Display.addFilter(...)
> to hook a listener that will be notified of all events of a specified
> type,
> regardless of the target widget. So if you listenened for SWT.KeyDown
> then
> you could look at each keystroke and if you detect a magic "move-to-x"
> keypress then you could change the focus accordingly. Note that you would
> also probably want to set the event's doit field to false in the case of
> interpreting it as a traversal so that it would not also be processed as a
> normal KeyDown in the original target widget.
>
> Grant
>
> "Michael Pellaton" <newsgroups@pellaton.li> wrote in message
> news:d14fik$nem$1@www.eclipse.org...
>> Hi
>>
>> I would like to reach every component that takes user input on an SWT
>> GUI (RCP application) using hotkeys/accelerator keys. So far, I managed
>> to implement this using Button, Label and Group objects ("&" in the text
>> property). However, I'd like to reach Text, Combo an Table objects
>> aswell using keys different than "tabbing" the cursor through the whole
>> tab order until the cursor is on the desired component.
>>
>> Can this be done in an easy way?
>> ... or do I have to implement listeners that control the focus?
>>
>> If the listener-solution is the way to go, how would you design focus
>> control of an entire GUI so that EVERY UI component is accessed using
>> the same mechanisms?
>>
>> Thanks for your help in advance!
>>
>> Michael Pellaton
>
>
Previous Topic:Change Button Label on PrintDialog
Next Topic:Regarding ComboBoxCellEditor...
Goto Forum:
  


Current Time: Tue Dec 10 22:03:43 GMT 2019

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

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

Back to the top