Setting Ctrl-+ as keystroke on a table [message #1403074] |
Mon, 21 July 2014 04:21  |
Eclipse User |
|
|
|
I've tried to define keystrokes on a TableField to allow me to use it purely with the keyboard without using the mouse. This approach works in general.
However, I've been unable to assing the key combination "ctrl-+" to my keystroke. It is listed when I call getKeystrokes() on my table, but it seems that this key combination is hard wired into the table to auto resize the column widhts. Whenever I press "Ctrl" and the "+" key on the numpad, instead of calling my keystroke, the columns are resized.
Do I need a special key-string to reference the num_pad_+ key or is it just not possible to override this key combination?
|
|
|
|
|
|
Re: Setting Ctrl-+ as keystroke on a table [message #1403233 is a reply to message #1403225] |
Tue, 22 July 2014 10:33   |
Eclipse User |
|
|
|
I had a look at Bug 422753. I think the correct way to define a shortcut using the numeric keypad goes like this:
@Order(10.0)
public class NumPadPlusKeyStroke extends AbstractKeyStroke {
@Override
protected String getConfiguredKeyStroke() {
return "CTRL-ADD";
}
@Override
protected void execAction() throws ProcessingException {
MessageBox.showOkMessage(null, getClass().getSimpleName(), null);
}
}
@Order(20.0)
public class NumPadMinusKeyStroke extends AbstractKeyStroke {
@Override
protected String getConfiguredKeyStroke() {
return "CTRL-SUBTRACT";
}
@Override
protected void execAction() throws ProcessingException {
MessageBox.showOkMessage(null, getClass().getSimpleName(), null);
}
}
@Order(30.0)
public class NumPadSlashKeyStroke extends AbstractKeyStroke {
@Override
protected String getConfiguredKeyStroke() {
return "CTRL-DIVIDE";
}
@Override
protected void execAction() throws ProcessingException {
MessageBox.showOkMessage(null, getClass().getSimpleName(), null);
}
}
@Order(40.0)
public class NumPadMultiplyKeyStroke extends AbstractKeyStroke {
@Override
protected String getConfiguredKeyStroke() {
return "CTRL-MULTIPLY";
}
@Override
protected void execAction() throws ProcessingException {
MessageBox.showOkMessage(null, getClass().getSimpleName(), null);
}
}
}
It works (with SWT and Swing).
We should document it on the KeyStroke wiki page.
.
[Updated on: Tue, 22 July 2014 10:34] by Moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10783 seconds