javalearner
javalearner

Reputation: 3382

GWT event that should be fired whenever textbox.setText() is called

I am using GWT textbox.

Whenever textbox.setText() method is called, i want to perform an action in some other class.

ValueChangeEvent is not fired whenever setText() is called.

Is there any event that will be fired or any ways to achieve this?

Please help

Upvotes: 0

Views: 281

Answers (2)

David
David

Reputation: 4285

You could try to use setValue(String value, boolean fireEvent) method

Upvotes: 3

Miquel
Miquel

Reputation: 15675

If you have a look at the TextBox.seText() method, you'll see that, all the way down to the actual DOM, no event is ever generated, so what you want to do simply won't work off-the-box.

I see two options:

  1. Whenever you call setText, you also call the event handler of your choice or, much better
  2. Make your own TextBox that extends TextBox, and override the setText() method so that it first calls super.setText() and then does whatever event generation you'd like

Upvotes: 0

Related Questions