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
This commit is contained in:
@@ -401,8 +401,6 @@ private :
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TE_UNLIMITED_LENGTH 0xFFFFFFFFUL
|
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
|
||||||
|
|
||||||
@@ -435,7 +433,7 @@ void wxTextCtrl::Init()
|
|||||||
m_editable = true ;
|
m_editable = true ;
|
||||||
m_dirty = false;
|
m_dirty = false;
|
||||||
|
|
||||||
m_maxLength = TE_UNLIMITED_LENGTH ;
|
m_maxLength = 0;
|
||||||
m_privateContextMenu = NULL;
|
m_privateContextMenu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -895,13 +893,16 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if we have reached the max # of chars, but still allow navigation and deletion
|
// Check if we have reached the max # of chars (if it is set), but still
|
||||||
if ( !IsMultiLine() && GetValue().Length() >= m_maxLength &&
|
// allow navigation and deletion
|
||||||
|
if ( !IsMultiLine() && m_maxLength && GetValue().Length() >= m_maxLength &&
|
||||||
key != WXK_LEFT && key != WXK_RIGHT && key != WXK_TAB &&
|
key != WXK_LEFT && key != WXK_RIGHT && key != WXK_TAB &&
|
||||||
key != WXK_BACK && !( key == WXK_RETURN && (m_windowStyle & wxPROCESS_ENTER) )
|
key != WXK_BACK && !( key == WXK_RETURN && (m_windowStyle & wxPROCESS_ENTER) )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// eat it, we don't want to add more than allowed # of characters
|
// eat it, we don't want to add more than allowed # of characters
|
||||||
|
|
||||||
|
// TODO: generate EVT_TEXT_MAXLEN()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user