From 3217f79df1fec0e7852b299a42776c99d74e95db Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Fri, 2 Jul 2010 14:24:45 +0000 Subject: [PATCH] Fixed and improved wxIntProperty's min/max validation failure message git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64791 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/propgrid/props.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/propgrid/props.cpp b/src/propgrid/props.cpp index eee0cca8cf..db637b2ffb 100644 --- a/src/propgrid/props.cpp +++ b/src/propgrid/props.cpp @@ -288,9 +288,17 @@ bool wxIntProperty::DoValidation( const wxPGProperty* property, wxLongLong_t& va if ( value < min ) { if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE ) - pValidationInfo->SetFailureMessage( - wxString::Format(_("Value must be %lld or higher"),min) - ); + { + wxString msg; + if ( !maxOk ) + msg = wxString::Format( + _("Value must be %lld or higher."), min); + else + msg = wxString::Format( + _("Value must be between %lld and %lld."), + min, max); + pValidationInfo->SetFailureMessage(msg); + } else if ( mode == wxPG_PROPERTY_VALIDATION_SATURATE ) value = min; else @@ -304,9 +312,17 @@ bool wxIntProperty::DoValidation( const wxPGProperty* property, wxLongLong_t& va if ( value > max ) { if ( mode == wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE ) - pValidationInfo->SetFailureMessage( - wxString::Format(_("Value must be %lld or higher"),min) - ); + { + wxString msg; + if ( !minOk ) + msg = wxString::Format( + _("Value must be %lld or lower."), max); + else + msg = wxString::Format( + _("Value must be between %lld and %lld."), + min, max); + pValidationInfo->SetFailureMessage(msg); + } else if ( mode == wxPG_PROPERTY_VALIDATION_SATURATE ) value = max; else