Well you must be adding keyboard listener to the textboxes, not to the
button.

- Litty Preeth

On Wed, Jan 14, 2009 at 3:55 PM, newlis <hrd...@yahoo.com> wrote:

>
> This is what i m do. What is wrong?
>
> public Login() {
>
>
>
>
> .....
>                signInButton = new Button();
>
>                signInButton.addClickListener(new ClickListener() {
>
>                        public void onClick(Widget sender) {
>
>                                if (textBoxUsername.getText().length() == 0
> ||
> textBoxPassword.getText().length() == 0) {
>
>                                        Window.alert("Username or password
> is empty.");
>
>                                }
>                                else
>                                // do something
>                               }
>                                });
>                signInButton.addKeyboardListener(new
> KeyboardListenerAdapter() {
>
>                        public void onKeyPress(Widget sender, char keyCode,
> int modifiers)
> {
>
>
>                        if(keyCode == KEY_ENTER) {
>
>                                 if (textBoxUsername.getText().length() == 0
> ||
> textBoxPassword.getText().length() == 0) {
>
>                                        Window.alert("Username or password
> is empty.");
>
>                                }
>                                else
>                                // do something
>                           }
>
>                        }
>
>                });
>
>
>                signInButton.setText("Sign In");
>
>        }
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to