Hey!
I have a slight problem detecting whether ctrl is pressed in a key event. i hook this on a Text:
@Override
public void keyPressed(KeyEvent e) {
System.out.println("key: " + e.keyCode + ", " + e.stateMask);
// get the current date and apply to the field
if (e.stateMask == SWT.CTRL && e.keyCode == SWT.ARROW_RIGHT) {
System.out.println("yeah!");
}
}
when i run this and press ctrl+right arrow i'd expect to get "yeah!". however i get this:
key: 262144, 0
key: 16777220, 0
seems the ctrl state is missing from the statemask, even though the ctrl press was recognized. as rap sends a keyup for all keys immediately (it does, right?) i get a keyup for ctrl immediately, thus i also cannot remember the state myself.
interesting thing is, that keeping ctrl pressed and pressing right arrow a second time yields this:
key: 262144, 0
key: 16777220, 0
key: 16777220, 262144
any insights? thanks in advance!
Markus