Ensure initial value of generic wxSpinCtrl is always valid
Under MSW creating a wxSpinCtrl with a range of, say, 1..10 and the default initial value of 0 sets its initial value to 1 (i.e. the closest valid value) as expected, but the generic version still set it to the invalid value of 0, which was unexpected, inconsistent and not useful. Fix the generic version to follow MSW behaviour now and add a test checking for this.
This commit is contained in:
@@ -145,6 +145,9 @@ protected:
|
||||
// check if the value is in range
|
||||
bool InRange(double n) const { return (n >= m_min) && (n <= m_max); }
|
||||
|
||||
// adjust the value to fit the range and snap it to ticks if necessary
|
||||
double AdjustAndSnap(double value) const;
|
||||
|
||||
// ensure that the value is in range wrapping it round if necessary
|
||||
double AdjustToFitInRange(double value) const;
|
||||
|
||||
|
Reference in New Issue
Block a user