accelerator keys / hotkeys [message #452157] |
Mon, 14 March 2005 11:53  |
Eclipse User |
|
|
|
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 12:40  |
Eclipse User |
|
|
|
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
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03530 seconds