I'm want do someStuff() when CTRL-C pressed. I had wrote some code, but it "not enough good". What can I do with it?)
//org.eclipse.draw2d.Shape getShape(){....}
getShape().addKeyListener(new KeyListener(){
@Override
public void keyPressed(KeyEvent ke) {
}
@Override
public void keyReleased(KeyEvent ke) {
/*if CTRL-C pressed*/
if((ke.getState() & KeyEvent.CONTROL) != 0 && 'c' == ('a' + ke.character - 1)){
someStuff();
}
}
});
Thanks.
Try this:
getShape().addListener(SWT.KeyUp, new Listener() {
public void handleEvent(Event event) {
if (event.stateMask == SWT.CTRL && event.keyCode == 'c') {
someStuff();
}
}});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With