X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3e026ad22ef21bf59b87c0933194535227c9ce2e..91452726c26d7c80b0f28b340659b8f22a501ddd:/src/common/valtext.cpp diff --git a/src/common/valtext.cpp b/src/common/valtext.cpp index ebd0c3cefc..43c87eb446 100644 --- a/src/common/valtext.cpp +++ b/src/common/valtext.cpp @@ -33,6 +33,8 @@ #include #include +#include "wx/combo.h" + // ---------------------------------------------------------------------------- // global helpers // ---------------------------------------------------------------------------- @@ -125,8 +127,16 @@ wxTextEntry *wxTextValidator::GetTextEntry() } #endif +#if wxUSE_COMBOCTRL + if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboCtrl))) + { + return (wxComboCtrl*)m_validatorWindow; + } +#endif + wxFAIL_MSG( - wxT("wxTextValidator can only be used with wxTextCtrl or wxComboBox") + "wxTextValidator can only be used with wxTextCtrl, wxComboBox, " + "or wxComboCtrl" ); return NULL; @@ -232,7 +242,7 @@ wxString wxTextValidator::IsValid(const wxString& val) const return _("'%s' should only contain alphabetic characters."); if ( HasFlag(wxFILTER_ALPHANUMERIC) && !CheckString(wxIsalnum, val) ) return _("'%s' should only contain alphabetic or numeric characters."); - if ( HasFlag(wxFILTER_DIGITS) && CheckString(wxIsdigit, val) ) + if ( HasFlag(wxFILTER_DIGITS) && !CheckString(wxIsdigit, val) ) return _("'%s' should only contain digits."); if ( HasFlag(wxFILTER_NUMERIC) && !wxIsNumeric(val) ) return _("'%s' should be numeric.");