X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f0d53ebfb2adaf97f851dd765b84b84cc355a6ef..f2616db56739e4962f683f59ac9e207756efe23c:/src/mac/textctrl.cpp diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 69da2912c7..f522366b32 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -680,12 +680,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