I had some input checking going on with the old KeyListener interface
that would cancelKey() the event if the input was not a digit.
I'm trying to convert that over to use a KeyDownHandler, but I can't
figure out how to check if they key is a digit.
This is the closest I've got:
public void onKeyDown(KeyDownEvent event)
{
int keyCode = event.getNativeKeyCode();
if (!Character.isDigit(keyCode)
{
// TextBox.cancelKey() suppresses the current keyboard event.
((TextBox) event.getSource()).cancelKey();
}
}
The catch is, Character.isDigit(int) is not emulated in GWT -- it only
accepts a char parameter.
So, how do I convert the keyCode to a char, or, check isDigit() on the
keyCode? Or an entirely different method? IS getNativeKeyCode() the
right approach for this?
--
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.