X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4c1fab95553e947c9f910469a440b6150475ac6..16d38102e8ad5534d185cc532b9aa8077a75e0a4:/src/mac/textctrl.cpp?ds=sidebyside diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index ddd40ad9d5..c6a6d86e09 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -13,6 +13,10 @@ #pragma implementation "textctrl.h" #endif +#include "wx/defs.h" + +#if wxUSE_TEXTCTRL + #ifdef __DARWIN__ #include #include @@ -624,10 +628,10 @@ wxString wxTextCtrl::GetLineText(long lineNo) const for (int j = i; j < actualsize; j++) { - tmp += wxBuffer[j]; - if (wxBuffer[j] == '\r') return tmp; + + tmp += wxBuffer[j]; } return tmp; @@ -680,12 +684,15 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) } if ( panel && panel->GetDefaultItem() ) { - wxButton *def = panel->GetDefaultItem() ; - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); - event.SetEventObject(def); - def->Command(event); - event.Skip() ; - return ; + wxButton *def = wxDynamicCast(panel->GetDefaultItem(), + wxButton); + if ( def && def->IsEnabled() ) + { + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); + event.SetEventObject(def); + def->Command(event); + return ; + } } } //else: multiline controls need Enter for themselves @@ -781,3 +788,5 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event) event.Enable( CanRedo() ); } +#endif + // wxUSE_TEXTCTRL