pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ocean ocean <riveroce...@gmail.com>
Subject Default Button on Forms
Date Sat, 27 Nov 2010 01:19:38 GMT
I'm still having a lot of trouble implementing the default button
functionality. Basically I'd like to have the user be able to type
'ctrl-enter' in various forms and have this automatically click on an 'OK'
button that causes the form to be submitted. This seemed to have been
working before but now it doesn't. I've tried adding a ComponentKeyListener
to both a Dialog and a Window (obtained via Dialog.getWindow()), that reacts
to ctrl-enter eg:

                new ComponentKeyListener.Adapter() {

                    public boolean keyTyped(Component component, char
character) {
                        if (character == Keyboard.KeyCode.ENTER &&
Keyboard.isPressed(Modifier.CTRL)) {
                            System.out.println("*** ctrl-enter pressed");
                            return true;
                        } else {
                            return false;

The problem seems to be that for forms that have TextInputs, this logic
doesn't work when those TextInputs have focus. In this case the TextInputs
consume the event. Is there a way to get my hands on the key typed before
any controls in the window/dialog consume it?

View raw message