From: Vadim Zeitlin Date: Fri, 27 Jan 2006 23:05:23 +0000 (+0000) Subject: don't eat all events if m_maxLength is 0: this means no limit according to the docs... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b9bae707bbf7ca87f0efdbf3c5a656a4d1f134e3 don't eat all events if m_maxLength is 0: this means no limit according to the docs and both wxMSW and wxGTK behave like this git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37187 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index ddc9c6261d..e5855c0fbb 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -401,8 +401,6 @@ private : #endif }; -#define TE_UNLIMITED_LENGTH 0xFFFFFFFFUL - IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl) @@ -435,7 +433,7 @@ void wxTextCtrl::Init() m_editable = true ; m_dirty = false; - m_maxLength = TE_UNLIMITED_LENGTH ; + m_maxLength = 0; m_privateContextMenu = NULL; } @@ -895,13 +893,16 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) return ; } - // Check if we have reached the max # of chars, but still allow navigation and deletion - if ( !IsMultiLine() && GetValue().Length() >= m_maxLength && + // Check if we have reached the max # of chars (if it is set), but still + // allow navigation and deletion + if ( !IsMultiLine() && m_maxLength && GetValue().Length() >= m_maxLength && key != WXK_LEFT && key != WXK_RIGHT && key != WXK_TAB && key != WXK_BACK && !( key == WXK_RETURN && (m_windowStyle & wxPROCESS_ENTER) ) ) { // eat it, we don't want to add more than allowed # of characters + + // TODO: generate EVT_TEXT_MAXLEN() return; }