I have a TextListener I want to change programatically without triggering its TextListener. I just want the text listener to activate on user text changing.
How should I proceed ?
TextField human = new TextField();
human.addTextListener(myListener);
// I don't want this line to trigger listener
human.setText(myString);
You could remove and re-add the listener or give it a boolean to toggle when it should listen.
Edit: per Tom Hawtin: the second recommendation, the one to use a flag, is much preferred over adding/removing a listener, and this makes sense to me as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With