Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » eRCP » Special characters get lost while posting them into currently focused input using
Special characters get lost while posting them into currently focused input using [message #498392] Mon, 16 November 2009 17:49
steve is currently offline steve
Messages: 2
Registered: November 2009
Junior Member
Dear all,

I am new to business, as well as new to this forum here... so I want to apologize in case this article/thread is already present in a similar way. I looked for it over 10 minutes, but I couldn't find any threads which somehow match or treat my problem.

So as the title already says, the library, the operating system behind or something else kinda swallos my special characters.
(what special characters are for ME: no digits (values) and no characters from a to z and A to Z. perfect example: - (dash))

background information and working scenario: I need to use the event) method as I need to simulate key and button presses (scanner device). (to be sure, the class is the correct and the only one I am talking about here.) furthermore, automatically uses the currently focused input field where the keys are inserted then. so if a scan is performed with the barcode scanner, the characteres and digits are automatically inserted into the input field (except for the special ones).

testing system: Symbol WT4090 device with Windows CE 5 operating system.
application that uses all this stuff: JAVA 1.4 using eSWT (eswt-converged-1-1.jar; eswt-converged.dll).

What already works (with implementation below): If it is a digit or a character, everything works perfectly. the characters (even on demand the capital ones (SHIFT)) are posted into the input field. each of the characters outside this range - the special characteres from above - does not work at all.

what i already figured/tried out (and of course did not bring me to the desired result in any way):

  • exchaning the eSWT-libs (.jar and .dll, which was not successfully; device did not even start the application)
  • all masks and combinations from SWT-constants (especially the interesting keyCode ones and the constants mapped by also) which were a lot,... and especially the following with AND and OR masking:
  • hard key events from SWT (SWT.HardKeyUp /-Down)
  • different encodings of barcodes => each of them ended up in the same result => scanner correctly processes the characters (debugged successfully)
  • took a look at the characters and keyCodes which apply to the ACSII table => should be correct as the digits and characters can be posted perfectly
  • took a look at the encoding which was not UTF-8 by default by the JVM, but should be correct also because of the same reason

current JAVA 1.4 implementation which works with a-z, A-Z and digits (as already said):

     * Posts a sequence of key events simulating a key stroke.
     * @param display display where the events should be fired
     * @param character character of the key to be pressed
    public static void postKeyStroke(Display display, char character) {
        final boolean shift = Character.isUpperCase(character);

        character = Character.toLowerCase(character);
        if (shift) {
            postKeyEvent(display, SWT.KeyDown, SWT.SHIFT);
        postKeyEvent(display, SWT.KeyDown, character);
        postKeyEvent(display, SWT.KeyUp, character);
        if (shift) {
            postKeyEvent(display, SWT.KeyUp, SWT.SHIFT);

     * Simulates a key event.
     * @param display display where the event should be fired
     * @param eventType type of the event
     * @param keyCode key code of the key to be "pressed"
    public static void postKeyEvent(Display display, int eventType, int keyCode) {
        final Event event = new Event();

        event.type = eventType;
        event.keyCode = keyCode;;

so do you see any problems in this implementation? do i have to deal with the special characters in a completely different way? are there any restrictions to those special characteres in eSWT? I am quite sure that swt is able to deal with them, there MUST be another problem, a wrong usage of the library...

does anybody have experience with that method and the usage and is able to help me?
i am sitting here for more than a week, and it's quite urgent as it is not possible testing without the dashes.

in my opinion, everything works ok till the native library is called, where I do not have sources either (, keyEventType, uglKeyCode, character)). this library even returns "true" which should indicate that everything worked OK. So I am really confused and tried nearly everything I can imagine to solve the problem. SWT books talk about a four-level-architecture (Window system - menu accelerators - traversal - focus control), where I suppose the special characters to be lost somewhere in between.

in case something is not entirely clear, or there is a lack of information, please just ask me! I am quite desperate already and very thankful for any kind of help or clue getting closer to the solution!

thank you very much for reading and already in advance for help,
Previous Topic:Newbie: eRCP and Android
Next Topic:Special characters get lost while posting them into currently focused input using
Goto Forum:

Current Time: Thu Oct 30 12:20:18 GMT 2014

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

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