key mapping SWT [message #186098] |
Fri, 01 July 2005 15:29 |
Eclipse User |
|
|
|
Originally posted by: user1981.gmail.com
Hi. I have a problem mapping keys on my editor. I saw two recent posts
about this kind of problems. From the answers of both i got something to
work but there's still something missing.
I have two types of key mapping:
keyhandler.put(KeyStroke.getPressed(SWT.DEL,127,0),
getActionRegistry().getAction(DeleteAction.ACTION_ID));
keyhandler.put(KeyStroke.getPressed('c',0x0063,0),
getActionRegistry().getAction(ChangeColorAction.ACTION_ID));
Now... i've tried combinations like getPressed(SWT.CTRL|'z',0) but they
are not working. Also i would like to make 'C' also pointing to the same
action as 'c' but using the hex code of 'C' nothing happens (i.e
getPressed('C',0x0043,0))
I'm using linux, fedora core 4 under the native eclipse.
Any ideas? thanks =)
|
|
|
Re: key mapping SWT [message #186159 is a reply to message #186098] |
Sat, 02 July 2005 11:38 |
Andreas Holtz Messages: 53 Registered: July 2009 |
Member |
|
|
Tiago schrieb am 01.07.2005 17:29:
>
> Hi. I have a problem mapping keys on my editor. I saw two recent posts
> about this kind of problems. From the answers of both i got something to
> work but there's still something missing.
>
> I have two types of key mapping:
>
> keyhandler.put(KeyStroke.getPressed(SWT.DEL,127,0),
> getActionRegistry().getAction(DeleteAction.ACTION_ID));
>
> keyhandler.put(KeyStroke.getPressed('c',0x0063,0),
> getActionRegistry().getAction(ChangeColorAction.ACTION_ID));
if you debug your application, is the corresponding command for your
Action created? to implement an own action inspect the logic-exmaple.
> Now... i've tried combinations like getPressed(SWT.CTRL|'z',0) but they
> are not working.
Ctrl+Z is normally mapped to undo. to overwrite the behaviour of those
actions, see other posts in this NG. i've never done it.
Andreas
|
|
|
Re: key mapping SWT [message #186194 is a reply to message #186098] |
Sun, 03 July 2005 01:07 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Another listener may be consuming that keystroke. The workbench has a
display filter for actions which are considered global. However, the filter
is not supposed to do anything if there is not an active undo action.
There is an SWT snippet which displays all info about every key event
received on its Control. You can use this to figure out what KeyStroke you
should be creating.
"Tiago" <user1981@gmail.com> wrote in message
news:6353f7fb373ec469e22d2c479034d251$1@www.eclipse.org...
>
> Hi. I have a problem mapping keys on my editor. I saw two recent posts
> about this kind of problems. From the answers of both i got something to
> work but there's still something missing.
>
> I have two types of key mapping:
>
> keyhandler.put(KeyStroke.getPressed(SWT.DEL,127,0),
> getActionRegistry().getAction(DeleteAction.ACTION_ID));
>
> keyhandler.put(KeyStroke.getPressed('c',0x0063,0),
> getActionRegistry().getAction(ChangeColorAction.ACTION_ID));
>
> Now... i've tried combinations like getPressed(SWT.CTRL|'z',0) but they
> are not working. Also i would like to make 'C' also pointing to the same
> action as 'c' but using the hex code of 'C' nothing happens (i.e
> getPressed('C',0x0043,0))
>
> I'm using linux, fedora core 4 under the native eclipse.
>
> Any ideas? thanks =)
>
|
|
|
Re: key mapping SWT [message #186404 is a reply to message #186194] |
Tue, 05 July 2005 14:27 |
Eclipse User |
|
|
|
Originally posted by: user1981.gmail.com
Well i got to solve the problem. I went to the snippet page and took a
look at the keystroke snippet. It was good to see that that i was catching
the keys has i should. The problem was that something was consuming the
event, not so sure what was... But it's all good now, has i implemented a
listener on my Editor's Class wichh was based on the one shown in the
snippet. From that event i got to choose between actions from my
ActionRegistry.
Thanks for the help
|
|
|
Powered by
FUDForum. Page generated in 0.03281 seconds