See also
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/661039239d5f06ab#

/dmc

On Tue, Dec 7, 2010 at 2:17 PM, John LaBanca <[email protected]> wrote:

> CharCodes and KeyCodes aren't the same thing.  A Char code represents the
> character that was typed, while a key code represents the physical key that
> was pressed.  For example, arrows have key codes but not char codes.
>  KeyCodes are only defined for keyDown and keyUp events, so you should use
> one of those events instead of keyPress.
>
> Thanks,
> John LaBanca
> [email protected]
>
>
>
> On Tue, Dec 7, 2010 at 1:52 PM, Magnus <[email protected]>wrote:
>
>> Hi,
>>
>> I try to detect the enter key on key press event:
>>
>>  public void onKeyPress(KeyPressEvent evt)
>>  {
>>  int c = evt.getNativeEvent().getCharCode();
>>
>>  if (c == KeyCodes.KEY_ENTER)
>>  {
>>   // doit();
>>  }
>>  }
>>
>> However, when the enter key is pressed, c is always 0, but
>> KeyCodes.KEY_ENTER is 13.
>>
>> What's the problem?
>>
>> Magnus
>>
>> --
>> 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]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>



-- 
David Chandler
Developer Programs Engineer, Google Web Toolkit
http://googlewebtoolkit.blogspot.com/

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