This, so I think, should work: 1. Your composite-panel-widget (which has 4 TextBoxes) implements the KeyBoardListener 2. Every TextBox will get a KeyBoardLisener (textBox.addKeyboardListener(this); // "this" is the Panel) 3. If "onKeyPress" is fired: check the Key, that was pressed. If it was "ENTER" call the onClick()- method (Event) from the Button inside the onKeyPress- Event.
If I understood correctly: you want to "simulate" clicking a button if the user pressed the EnterKex while editing a TextBox... Hope that was helpful... 2008/12/12 Riyaz Mansoor <[email protected]> > > > For a PopupPanel take a look at onKeyPressPreview - handle ENTER, ESC > etc key events there. > > Generally, you are looking at over-riding onEventPreview to handle the > keyboard events you want. > > There is no magical "setDefaultButton" method. In fact, the default > button formatting (if required) you have to implement separately. > > > On Dec 12, 4:59 am, "[email protected]" <[email protected]> > wrote: > > Maybe others with more GWT Form experience can chime in, but adding a > > KeyboardListener to your text boxes to do a form submit seems > > completely reasonable and non-hacky. In fact, it's completely in line > > with traditional UI paradigms, where the whole form submit() concept > > and all is what's really unusual. Another idea is to extend the > > FormPanel to something like MyCoolFormPanel and add your > > own .setDefaultButton method on it. Simply my random thoughts. Good > > luck! > > > > Later, > > > > Shaffer > > > > On Dec 11, 2:06 pm, UVic_Paul <[email protected]> wrote: > > > > > Hey all, > > > > > Been searching around without success, so time to ask the group.... > > > > > How do you (or can you) set the default button on a "form"? > > > > > For example, let's say you have a panel with 4 TextBox widgets, an > > > "Enter" button, and a "Cancel" button. When the user presses "Enter" > > > during input of any of the 4 Text Boxes, I want to act as if the > > > "Enter" button had been clicked. > > > > > In Swing, you'd do something like: > > > JRootPane rootPane = frame.getRootPane(); > > > rootPane.setDefaultButton(enterButton); > > > > > I realize I can create a KeyboardListener, attach it to all 4 Text > > > Boxes, and react when "Enter" is pressed, but that seems like a bit of > > > a hack to me. > > > > > thanks in advance, > > > Paul > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
