X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/665b537f51f768e19cff57fa9b351a530d6b2015..0e859e32234b3178254146f31653f478de0c5fba:/src/mac/carbon/textctrl.cpp diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index ddc9c6261d..3a6d9020bb 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; } @@ -1108,7 +1109,7 @@ void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event) m_privateContextMenu->AppendSeparator(); m_privateContextMenu->Append(wxID_SELECTALL, _("Select &All")); } - + if (m_privateContextMenu != NULL) PopupMenu(m_privateContextMenu); } @@ -1438,7 +1439,9 @@ bool wxMacUnicodeTextControl::CanPaste() const void wxMacUnicodeTextControl::SetEditable(bool editable) { - SetData( 0 , kControlEditTextLockedTag , (Boolean) !editable ) ; +#if 0 // leads to problem because text cannot be selected anymore + SetData( kControlEditTextPart , kControlEditTextLockedTag , (Boolean) !editable ) ; +#endif } void wxMacUnicodeTextControl::GetSelection( long* from, long* to ) const