> * MaxValue=-10, Minvalue=10 --> ok, there is no error message, but also, there is no unlimited spinning: clicking the spin buttons makes the edit jump between -10 and 10 without the intermediate values.
Understandable as well because what else would you do if max < min is allowed?
Ok:
MinValue means: Minimal Value.
MaxValue means: Maximum Value.
MinValue = 10
MaxValue = -10
How can any number be <= -10 and at the same time >= 10?
It cannot be.
The behaviour of the control in this case is "undefined", as in: it is never described in the documentation (of Delphi) how it should behave.
The behaviour in Delphi is most likely a side effect of how it was implemented.
(Naïve approach: if Value<MinValue then Value:=MinValue; then followed by if Value>MaxValue then Value:=MaxValue. Mind you I never looked at the source code of Delphi's TSpinEdit.)
Most likely they never even considered a user causing this.
For the same reason ("undefined") our implementation is valid as well.
IMO it is a bit less moronic then Delphi's implementation.
Most users (like you) will never have MinValue>MaxValue and will never encouter our implementation, nor Delphi's one.
(When I implemented it this way, I did blackbox testing agains D3 and tried to think of weird situations and then stubled upon this.)
In both cases (Delphi as well as Lazarus) they will find out the control behaves not exactly as they intended.
There is no "proper" way to handle this situation.
Raising an exception? Now the programmer always has to first examine the value of both MinValue and MaxValue if he wants to change both.
Simply disallow it? Same problem.
If primitive types were nullable, Value could return Null.
That would at least make some sense of it all.
But since that is not the case, we must return an actual Double or Integer.
Bart