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
This commit is contained in:
@@ -397,18 +397,13 @@ wxButton::SetDefaultStyle(wxButton *btn, bool on)
|
|||||||
if ( !wxTheApp->IsActive() )
|
if ( !wxTheApp->IsActive() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// look for a panel-like window
|
wxWindow * const parent = btn->GetParent();
|
||||||
wxWindow *win = btn->GetParent();
|
wxCHECK_RET( parent, _T("button without parent?") );
|
||||||
while ( win && !win->HasFlag(wxTAB_TRAVERSAL) )
|
|
||||||
win = win->GetParent();
|
|
||||||
|
|
||||||
if ( win )
|
::SendMessage(GetHwndOf(parent), DM_SETDEFID, btn->GetId(), 0L);
|
||||||
{
|
|
||||||
::SendMessage(GetHwndOf(win), DM_SETDEFID, btn->GetId(), 0L);
|
|
||||||
|
|
||||||
// sending DM_SETDEFID also changes the button style to
|
// sending DM_SETDEFID also changes the button style to
|
||||||
// BS_DEFPUSHBUTTON so there is nothing more to do
|
// BS_DEFPUSHBUTTON so there is nothing more to do
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// then also change the style as needed
|
// then also change the style as needed
|
||||||
|
Reference in New Issue
Block a user