On 14 août, 21:37, rakesh wagh <rake...@gmail.com> wrote:
> Today While extending the TextBox, I encountered very strange
> behaviour.
> All alphabets returned by event.getNativeKeyCode() are upper case.
> Here is sample program:
>
> public class TextBox extends com.google.gwt.user.client.ui.TextBox{
> public TextBox() {
> super();
> addKeyDownHandler(new KeyDownHandler(){
> public void onKeyDown(KeyDownEvent event) {
> int key = event.getNativeKeyCode();
> System.out.println("key: " +
> (char)key);
> }
> }
> }
>
> }
>
> Enter characters in lower case, it will print upper case to the
> console. I thought of checking with the group before raising it as an
> issue. Any idea on what's going on here?
You're confusing "key codes" with "characters". Key codes (as well as
keydown and keyup events) are really about keyboard *keys* that you
depress (or at least should be, as it differs a bit amongst browsers).
This was really confusing in GWT 1.5 and previous versions, since GWT
1.6 and the new events, it's a bit clearer, but still somewhat buggy
(see issue 3753:
http://code.google.com/p/google-web-toolkit/issues/detail?id=3753
)
See also issues 72 (among others):
http://code.google.com/p/google-web-toolkit/issues/detail?id=72
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---