X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d5c15163a2e346c30fe3136e6668a20bab7d7d2..4d8209b9070ea7120078e83a648f3627e57bc15a:/src/osx/textctrl_osx.cpp diff --git a/src/osx/textctrl_osx.cpp b/src/osx/textctrl_osx.cpp index 8c2f1d83da..aa500bce44 100644 --- a/src/osx/textctrl_osx.cpp +++ b/src/osx/textctrl_osx.cpp @@ -154,11 +154,6 @@ void wxTextCtrl::MacCheckSpelling(bool check) GetTextPeer()->CheckSpelling(check); } -void wxTextCtrl::SetMaxLength(unsigned long len) -{ - m_maxLength = len ; -} - bool wxTextCtrl::SetFont( const wxFont& font ) { if ( !wxTextCtrlBase::SetFont( font ) ) @@ -339,7 +334,7 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event) void wxTextCtrl::OnKeyDown(wxKeyEvent& event) { - if ( event.GetModifiers() == wxMOD_CMD ) + if ( event.GetModifiers() == wxMOD_CONTROL ) { switch( event.GetKeyCode() ) { @@ -381,18 +376,21 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) return ; } - // Check if we have reached the max # of chars (if it is set), but still - // allow navigation and deletion - GetSelection( &from, &to ); - if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength && - !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) && - !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) && - from == to ) + if ( !GetTextPeer()->CanClipMaxLength() ) { - // eat it, we don't want to add more than allowed # of characters + // Check if we have reached the max # of chars (if it is set), but still + // allow navigation and deletion + GetSelection( &from, &to ); + if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength && + !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) && + !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) && + from == to ) + { + // eat it, we don't want to add more than allowed # of characters - // TODO: generate EVT_TEXT_MAXLEN() - return; + // TODO: generate EVT_TEXT_MAXLEN() + return; + } } // assume that any key not processed yet is going to modify the control