Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Forwarding keystrokes from one Widget to another.

Hello,
    I am trying to forward keystrokes between two a StyledText and a Text. When the StyledText has focus I want to forward most key strokes to the Text. I am using swt 3.6M3. This is a trimmed down version of the code I currently have:

styledText.addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent event) {
            //Some filtering has been left out that checks for certain characters.
            processKeystroke(event);
        }
    });

void processKeystroke(KeyEvent event) {
text.append("" + event.character);
}

This works quite well in OS X and Linux even if the user types fast. I manage to catch all of the keystrokes and they are forwarded without any issues. However, in windows some keystrokes are missed. If the user types "this is a test" really quickly I will see output like "his isa test" in the Text. I was wondering if anyone had any suggestions or other ideas to try. Also is it possible to publish a KeyEvent on the Text programatically?

Thanks,
Carson Day

Back to the top