Michael
Michael

Reputation: 1397

GWT how to change textbox without running change handler

I am using GWT. I have a textbox and a drop down list box that have change handlers on them. I also sometimes change the text or selected value from the source code but I don't want the change handler to run when I do this, I only want it to run when the user changes it.

How can I implement this?

Upvotes: 1

Views: 234

Answers (1)

Andrea Boscolo
Andrea Boscolo

Reputation: 3048

For the TextBox, use setValue(T value, boolean fireEvents) using false as second argument, to avoid firing any ValueChangeEvent.

For the ListBox, when you call setSelectedIndex(int index) or setItemSelected(int index, boolean selected) the ChangeEvent is never fired, so you are free to use them programmatically and rely on the ChangeHandler on user action.

Upvotes: 3

Related Questions