On Thu, Jan 8, 2009 at 8:44 AM, Smith <[email protected]> wrote: > > I have a login page and I need to enable the user to hit the enter key > after giving the user name and password. It's not in a FormPanel. The > login button has a click listener. > Also, if the login fails, how do I bring the cursor back to either the > user name or password text boxes.
You can add a keyboard listener to this boxes. http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/FocusWidget.html#addKeyboardListener(com.google.gwt.user.client.ui.KeyboardListener) You want to check the keycode for the value "KEY_ENTER". box.addKeyboardListener(new KeyboardListenerAdapter() { public void onKeyPress(Widget sender, char keyCode, int modifiers) { if (keyCode == KEY_ENTER) { // yay! } else if (keyCode == KEY_ESCAPE) { // boo! } } }); -Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
