From: Vadim Zeitlin Date: Sun, 16 Jul 2006 19:23:03 +0000 (+0000) Subject: remove the search for parent with wxTAB_TRAVERSAL style in SetDefaultStyle(): it... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/cef55d6485619c56fb7af4c2cc23e8bbcb86b74f remove the search for parent with wxTAB_TRAVERSAL style in SetDefaultStyle(): it's useless as DM_SETDEFID can be only sent to the immediate parent anyhow, apparently git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/button.cpp b/src/msw/button.cpp index e512e506d2..afb5670992 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -397,18 +397,13 @@ wxButton::SetDefaultStyle(wxButton *btn, bool on) if ( !wxTheApp->IsActive() ) return; - // look for a panel-like window - wxWindow *win = btn->GetParent(); - while ( win && !win->HasFlag(wxTAB_TRAVERSAL) ) - win = win->GetParent(); + wxWindow * const parent = btn->GetParent(); + wxCHECK_RET( parent, _T("button without parent?") ); - if ( win ) - { - ::SendMessage(GetHwndOf(win), DM_SETDEFID, btn->GetId(), 0L); + ::SendMessage(GetHwndOf(parent), DM_SETDEFID, btn->GetId(), 0L); - // sending DM_SETDEFID also changes the button style to - // BS_DEFPUSHBUTTON so there is nothing more to do - } + // sending DM_SETDEFID also changes the button style to + // BS_DEFPUSHBUTTON so there is nothing more to do } // then also change the style as needed