Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Sorry for so many posts :( - Simualte KeyEvent "!" character
Sorry for so many posts :( - Simualte KeyEvent "!" character [message #534001] Mon, 17 May 2010 12:29
Eclipse UserFriend
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
Previous Topic:Context-sensitive popup menu on TreeItem - trying to avoid extra Dispatch loops
Next Topic:Combo: how to get rid of the 3d bar
Goto Forum:
  


Current Time: Wed Jul 02 19:32:47 EDT 2025

Powered by FUDForum. Page generated in 0.03434 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top