[regression] T(Float)SpinEdit
- Lazarus/FPC Version: Lazarus 2.2.0 (rev lazarus_2_2_0-6-g47343439) FPC 3.2.3 x86_64-win64-win32/win64
The problem is that in Laz 2.0 one only had to set one limit for SpinEdits when one only needed one. For example when you had an edit for percentages, you only set a MinValue of e.g. "1". The MaxValue was not explicitly set but interpreted as "100". result: with Laz 2.0 such an edit was limited between 1 and 100
Now with Laz 2.2 the unset MaxValue is interpreted as "0". In effect Max < Min and then the edit is no longer limited result: users can now enter e.g. "0" to the edit and trigger a divide by zero or other unwanted things.
With "unset" I mean that the value for the MaxValue is not written to the *.lfm file.
To reproduce you can take the example file from my report in the forum: https://forum.lazarus.freepascal.org/index.php/topic,57722.msg429438.html#msg429438
To fix this I propose:
- when there is in the .lfm file a MinValue with a value below 100, an unset MaxValue is interpreted as "100", otherwise as MinValue + 1. This way no regression can occur.
- the IDE should not allow to enter Min > Max. I showed 2 possibilities for an implementation here: https://forum.lazarus.freepascal.org/index.php/topic,57722.msg429540.html#msg429540 (I would prefer possibility A and the underlying code is from a TAChart example, so from @wpam )
- ideally also this: when compiling and Max is set < Min at runtime, there should be a warning in the compiler messages.