X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f0d53ebfb2adaf97f851dd765b84b84cc355a6ef..89fcec9514fd890de58da83118363570e2482bc9:/src/mac/textctrl.cpp?ds=inline diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 69da2912c7..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 @@ -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