Validate input in generic wxSpinCtrl and wxSpinCtrlDouble

Use respective validator to control what is typed in the text field.

Closes #17882.
This commit is contained in:
Artur Wieczorek
2020-06-11 15:28:38 +02:00
parent 0ca6be3cf4
commit 7c3d540c70
2 changed files with 41 additions and 0 deletions

View File

@@ -147,6 +147,8 @@ protected:
// ensure that the value is in range wrapping it round if necessary
double AdjustToFitInRange(double value) const;
// Assign validator with current parameters
virtual void ResetTextValidator() = 0;
double m_value;
double m_min;
@@ -331,6 +333,7 @@ protected:
virtual bool DoTextToValue(const wxString& text, double *val);
virtual wxString DoValueToText(double val);
virtual void ResetTextValidator() wxOVERRIDE;
private:
// Common part of all ctors.
@@ -411,6 +414,7 @@ protected:
virtual bool DoTextToValue(const wxString& text, double *val) wxOVERRIDE;
virtual wxString DoValueToText(double val) wxOVERRIDE;
virtual void ResetTextValidator() wxOVERRIDE;
void DetermineDigits(double inc);
unsigned m_digits;