Validate typing in SpNumberInputFieldPresenter
By typing in a SpNumberInputFieldPresenter field instead of incrementing/decrementing with the up/down arrows, the number range (minimum/maximum) can be duped. The field can also be emptied or filled with wrong characters.
Thanks for the report. Do you have a little code snippet reproducing the problems?
| boxLayout |
boxLayout := SpBoxLayout newLeftToRight
add: (SpNumberInputFieldPresenter new
number: 10;
minimum: 1;
maximum: 15;
climbRate: 1;
disable;
yourself) width: 100;
add: SpTextInputFieldPresenter new.
SpPresenter new
layout: boxLayout;
open
Note also that #disable is not effective (issue #1798) .
TX!!!!
holidays! See you end august :P
ok, I am working on this now. this widget has different problems :)
- it is not honoring enable/disable, as you are disabling it and it still works
- is accepting alpha characters and it shouldn't.
- you can type numbers other than the ones in the min/max range.
These are all different problems but I will try to tackle all...
@Driolar first one thing: Never ever create your presenters as you are doing in the example!
If you create your presenter as you show there (SpNumberInputFieldPresenter new) you risk creating a presenter outside the POM (Presenter Object Model), and hence you may have a lot of problems...)
Instead, you need to instantiate your presenters using newYourPresenter or instantiate: YourPresenterClass methods.
e.g., I translated your example to this:
app := SpApplication new.
presenter := SpPresenter newApplication: app.
presenter layout: SpBoxLayout newTopToBottom vAlignStart.
numberInput := presenter newNumberInput
number: 10;
minimum: 1;
maximum: 15;
climbRate: 1;
yourself.
presenter layout add: numberInput.
presenter layout add: presenter newTextInput.
presenter open.