Fixed displaying validation error for numeric wxPG properties (wxUIntProperty, etc.)

When entered wxFloatProperty, wxIntProperty or wxUIntProperty is out of range then there is displayed a warning message presenting a valid range. Instead of displaying in this message numeric values in default (and fixed) format we should display values which are formatted based on to the current attributes of the property (like wxPG_UINT_PREFIX, wxPG_UINT_BASE, wxPG_FLOAT_PRECISION).
To do so, we shouldn't format respective values on our own in NumericValidation() but instead call wxPGProperty()::ValueToString() which returns value string formatted in line with attributes.

Closes #17601
This commit is contained in:
Artur Wieczorek
2016-07-21 23:13:15 +02:00
parent 6e97a2cbf2
commit c3fa684a27
2 changed files with 83 additions and 36 deletions

View File

@@ -242,13 +242,21 @@ public:
/** Validation helpers.
*/
#if defined(wxLongLong_t) && wxUSE_LONGLONG
#if wxUSE_LONGLONG
static bool DoValidation( const wxPGProperty* property,
wxLongLong& value,
wxPGValidationInfo* pValidationInfo,
int mode =
wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE );
#if defined(wxLongLong_t)
static bool DoValidation( const wxPGProperty* property,
wxLongLong_t& value,
wxPGValidationInfo* pValidationInfo,
int mode =
wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE );
#endif
#endif // wxLongLong_t
#endif // wxUSE_LONGLONG
static bool DoValidation(const wxPGProperty* property,
long& value,
wxPGValidationInfo* pValidationInfo,
@@ -311,12 +319,18 @@ private:
void Init();
// Validation helpers.
#if defined(wxULongLong_t) && wxUSE_LONGLONG
#if wxUSE_LONGLONG
static bool DoValidation(const wxPGProperty* property,
wxULongLong& value,
wxPGValidationInfo* pValidationInfo,
int mode =wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
#if defined(wxULongLong_t)
static bool DoValidation(const wxPGProperty* property,
wxULongLong_t& value,
wxPGValidationInfo* pValidationInfo,
int mode =wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE);
#endif
#endif // wxULongLong_t
#endif // wxUSE_LONGLONG
static bool DoValidation(const wxPGProperty* property,
long& value,
wxPGValidationInfo* pValidationInfo,