X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8e609c82594a57104ff5e0d4044b2e2697a4b576..ad0023978e7a61369f3180241f217df283308388:/src/mac/carbon/button.cpp diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index c5a3f521bd..55785b73ac 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -15,6 +15,7 @@ #ifndef WX_PRECOMP #include "wx/panel.h" + #include "wx/toplevel.h" #endif #include "wx/stockitem.h" @@ -102,13 +103,12 @@ bool wxButton::Create(wxWindow *parent, void wxButton::SetDefault() { - wxWindow *parent = GetParent(); + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); wxButton *btnOldDefault = NULL; - - if ( parent ) + if ( tlw ) { - btnOldDefault = wxDynamicCast(parent->GetDefaultItem(), wxButton); - parent->SetDefaultItem(this); + btnOldDefault = wxDynamicCast(tlw->GetDefaultItem(), wxButton); + tlw->SetDefaultItem(this); } if ( btnOldDefault )