X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7102c47355e27d55f86d42cad4c2c1edfb533ae9..50dee7e0ebbe05574116dce391596ddc55d644be:/src/common/valtext.cpp?ds=sidebyside diff --git a/src/common/valtext.cpp b/src/common/valtext.cpp index 252793377a..90627aa28d 100644 --- a/src/common/valtext.cpp +++ b/src/common/valtext.cpp @@ -20,7 +20,7 @@ #pragma hdrstop #endif -#if wxUSE_VALIDATORS +#if wxUSE_VALIDATORS && wxUSE_TEXTCTRL #ifndef WX_PRECOMP #include @@ -206,6 +206,9 @@ bool wxTextValidator::TransferToWindow(void) if( !CheckValidator() ) return FALSE; + if (!m_stringValue) + return TRUE; + wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ; control->SetValue(* m_stringValue) ; @@ -218,6 +221,9 @@ bool wxTextValidator::TransferFromWindow(void) if( !CheckValidator() ) return FALSE; + if (!m_stringValue) + return TRUE; + wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ; * m_stringValue = control->GetValue() ; @@ -303,8 +309,7 @@ static bool wxIsNumeric(const wxString& val) { // Allow for "," (French) as well as "." -- in future we should // use wxSystemSettings or other to do better localisation - if ((!isdigit(val[i])) && (val[i] != '.') && (val[i] != ',') && (val[i] != wxT('e')) && (val[i] != wxT('E'))) - if(!((i == 0) && (val[i] == '-'))) + if ((!isdigit(val[i])) && (val[i] != '.') && (val[i] != ',') && (val[i] != wxT('e')) && (val[i] != wxT('E')) && (val[i] != wxT('+')) && (val[i] != wxT('-'))) return FALSE; } return TRUE; @@ -333,4 +338,4 @@ bool wxTextValidator::IsNotInCharExcludeList(const wxString& val) } #endif - // wxUSE_VALIDATORS + // wxUSE_VALIDATORS && wxUSE_TEXTCTRL