#ifndef WX_PRECOMP
#include "wx/panel.h"
+ #include "wx/toplevel.h"
#endif
#include "wx/stockitem.h"
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 )