X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f1e01716310cb6e3bfcf5894b442d277bc32789a..b0b96f667dbc2fc2d3ebaa342c50bdea10f84a91:/src/mac/classic/combobox.cpp?ds=sidebyside diff --git a/src/mac/classic/combobox.cpp b/src/mac/classic/combobox.cpp index 5af51c8fa8..2879e2a3eb 100644 --- a/src/mac/classic/combobox.cpp +++ b/src/mac/classic/combobox.cpp @@ -15,9 +15,9 @@ #ifndef WX_PRECOMP #include "wx/button.h" + #include "wx/menu.h" #endif -#include "wx/menu.h" #include "wx/mac/uma.h" IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) @@ -94,14 +94,10 @@ protected: // This will invoke the dialog default action, such // as the clicking the default button. - wxWindow *parent = GetParent(); - while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) { - parent = parent->GetParent() ; - } - if ( parent && parent->GetDefaultItem() ) + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( tlw && tlw->GetDefaultItem() ) { - wxButton *def = wxDynamicCast(parent->GetDefaultItem(), - wxButton); + wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton); if ( def && def->IsEnabled() ) { wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );