Hi guys,
Consider the following code:
Our users use negative numbers, but when they clear the spinneritem, they cannot enter a new negative number by entering '-'. The event is not registered and nothing shows in the field. Instead they have to write the number first and then move the cursor to the beginning of the field and then enter the '-'.
It is a requirement that item.setChangeOnKeypress is set to true, so that each key event is firing a change/changed event. Of course, no event is expected when just '-' is entered, since this is not a valid value.
Is this achievable somehow?
We have tested with:
12.1-d20200307
12.0-p20191129
Best Regards
Rasmus
Consider the following code:
Code:
public class App implements EntryPoint { public void onModuleLoad() { List<Canvas> members = new ArrayList<>(); members.add(testSpinnerItemNegativeValue()); Layout panel = new VLayout(); panel.setWidth100(); panel.setHeight100(); panel.setMembers(members.toArray(new Canvas[0])); panel.draw(); } private Canvas testSpinnerItemNegativeValue() { SpinnerItem item = new SpinnerItem(); item.setMax(5); item.setMin(-5); item.setChangeOnKeypress(true); item.addChangedHandler(changedEvent -> GWT.log("spinnerItem.onChanged")); item.addChangeHandler(changeEvent -> GWT.log("spinnerItem.onChange")); DynamicForm form = new DynamicForm(); form.setWidth100(); form.setItems(item); return form; } }
It is a requirement that item.setChangeOnKeypress is set to true, so that each key event is firing a change/changed event. Of course, no event is expected when just '-' is entered, since this is not a valid value.
Is this achievable somehow?
We have tested with:
12.1-d20200307
12.0-p20191129
Best Regards
Rasmus
Comment