Just implement KeyPressHandleron the onKeyPress method check the char code
and cancel the key when appropriate.

See the example at the TextBox api docs
http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/TextBox.html

Regards,
Pablo


On Mon, Jun 29, 2009 at 7:05 AM, Dominik Erbsland <[email protected]>wrote:

>
> thanks for the help so far.
> I am aware that there is a new handler system - I just can't figure
> out a way how to make a TextBox field "numbers only".
> I tried with a KeyUpHandler and a ValueChangeHandler but could not
> find suitable methods to check the input for its validity.
> any hints?
>
>
> On Jun 26, 8:21 pm, Miroslav Genov <[email protected]> wrote:
> > In GWT 1.6 old listener api has been deprecated and were introduced new
> > event system which is using handlers. More information about your case
> > can be taken from:
> >
> >  http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/g.
> ..
> >
> >  textBox.addKeyPressHandler and so on.
> >
> >  Wish you good luck.
> >
> > Regards,
> >   Miroslav
> >
> > Dominik Erbsland wrote:
> > > I just saw that addKeyListener() is deprecated in gwt 1.6.4.
> > > Actually I just wanted to make a listener which checks the user input
> > > in a text box and allows only numbers.
> >
> > > with gwt 1.6.4 I could not figure out how to do that since I should
> > > not use the keyboard listener anymore.
> > > any hints how I can check the input with the KeyUpHandler of gwt
> > > 1.6.4?
> >
> > > thanks in advance.
> >
>

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