Sorry for so many posts :( - Simualte KeyEvent "!" character [message #534001] |
Mon, 17 May 2010 16:29 |
Misha Koshelev Messages: 31 Registered: May 2010 |
Member |
|
|
My apologies per:
http://book.javanb.com/swt-the-standard-widget-toolkit/ch02l ev1sec2.html
"For key events that represent characters found in the Unicode character set, the character field is set to the matching (Unicode) char value. For example, when the user presses the <a> key, an SWT.KeyDown event is issued. The character field in this event has the (char) value a.
Despite the fact that SWT characters are just Java char values, convenience constants are provided for most common control characters, even those that have standard escape sequences (such as '\n' for linefeed). Programmers are free to use the constants (found in Table 2.4) or their equivalents."
I would imagine that:
Event event=new Event();
event.character='!';
event.display=Display.getDefault();
event.type=SWT.KeyDown;
display.post(event);
would send a '!' character, but it actually sends a 1.
Is there an easy way to convert characters to characters+modifiers so that it sends the correct character, or is this a bug?
Thank you
Misha
|
|
|
Powered by
FUDForum. Page generated in 0.03274 seconds