Greg,

As I mentioned in a thread earlier today (
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/82a98103dfa76528),
try using a KeyDownEvent handler and inspect
event.getNativeEvent().getKeyCode()
instead of event.getCharCode().

>From the other thread, it sounds like this behavior may have changed in 2.1,
so it could be that the documentation is wrong, but only as of fairly
recently.

-Brian

On Fri, Dec 3, 2010 at 3:21 PM, Greg Dougherty
<[email protected]>wrote:

> Ok, the tutorial says that to get a user pressing an enter key in a
> TextBox you should write something like the following:
>
> http://code.google.com/webtoolkit/doc/latest/tutorial/manageevents.html
>
>        public void onKeyPress (KeyPressEvent event)
>        {
>                char    keyPress = event.getCharCode();
>                int     keyCode = keyPress;
>                if (keyPress == KeyCodes.KEY_ENTER)
>                        goToRecord ();
>        }
>
> Unfortunately, when I do that, I get a keyCode of 0 for  Enter, Tab,
> and Left Arrow (the keys I tested), while I get the actual key when I
> type a number key.  What gives?  Is the tutorial wrong?  If so, what
> should I be calling?
>
> TIA,
>
> Greg
>
> --
> 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]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
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.

Reply via email to