X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ffafe6ca89c4284aaf7d2d1d4757d63bf7d50ff0..0e859e32234b3178254146f31653f478de0c5fba:/src/mac/carbon/textctrl.cpp?ds=sidebyside diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 91823a80fb..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; } @@ -990,23 +991,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) if (!eat_key) { // perform keystroke handling - if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL ) - { - CallNextEventHandler( (EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef(), (EventRef)wxTheApp->MacGetCurrentEvent() ) ; - } - else - { - EventRecord rec ; - if ( wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ) - { - short keycode, keychar ; - EventRecord *ev = &rec ; - keychar = short(ev->message & charCodeMask); - keycode = short(ev->message & keyCodeMask) >> 8 ; - - m_peer->HandleKey( keycode , keychar , ev->modifiers ) ; - } - } + event.Skip(true) ; } if ( ( key >= 0x20 && key < WXK_START ) || @@ -1124,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); } @@ -1454,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