If you want to be notified for each char change then you should use onKeyUp
else if you want to process the text after all the text has been entered
then u shud use onChange of ChangeListener.


On Thu, Dec 11, 2008 at 10:51 PM, David Hoffer <dhoff...@gmail.com> wrote:

>
> Is this better than using onKeyUp() ?  What are the pros/cons?
>
> -Dave
>
> On Thu, Dec 11, 2008 at 8:31 AM, Jason Essington
> <jason.essing...@gmail.com> wrote:
> >
> > That's correct, onChange fires after the text box looses focus, but
> > you can listen to onkeypress. onKeypress is fired before the text box
> > is updated allowing you to cancel the keypress if desired. The trick
> > is to use DeferredCommand.addCommand() to handle the text.
> >
> > public void onKeyPress(Widget sender, char keyCode, int modifiers){
> >   // check if the keycode is something you are concerned about
> >   DeferredCommand.addCommand(new Command(){
> >     public void execute(){
> >       // read the updated text in the textbox now.
> >     }
> >   });
> > }
> >
> > -jason
> >
> > On Dec 10, 2008, at 5:50 PM, dhoffer wrote:
> >
> >>
> >> Does anyone know how to configure GWT's TextBox so I can be notified
> >> when its contents changes?
> >>
> >> I have just found out that addChangeListener does not work because it
> >> only gets fired when the user leaves the text box.
> >>
> >> Also addKeyboardListener does not do what I need because this is fired
> >> BEFORE the contents of the text box have been changed/updated (so
> >> calling getText() returns the previous text).
> >> >
> >
> >
> > >
> >
>
> >
>

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

Reply via email to