Open diamondobama opened 8 years ago
I'm not sure we'd want to fix that. DataChangedListener is verbose by definition and it's the responsibility of the listener to only use the event callbacks that matter. Some code might rely on this over verboseness and break.
When you add a DataChangeListener to a TextField and you type some text, the TextField receives extra event when it lost focus.
How to reproduce Issue:
Add a TextField to a form and apply a data change listener, then output the text as you type, click outside the TextField and check your log. You will see the last value repeated.
Test Code:
Form form = new Form();
TextField txtTest = new TextField("");
txtTest.addDataChangeListener((evtt, evt2) -> {
System.out.println(txtTest.getText());
}
form.add(txtTest);
form.show();
Test with "1234".
Expected Output: 1 12 123 1234
Output: 1 12 123 1234 1234