+ if (pParent)
+ {
+ wxWindow* pWinOldDefault = pParent->SetDefaultItem(this);
+
+ pBtnOldDefault = wxDynamicCast(pWinOldDefault, wxButton);
+ }
+ if (pBtnOldDefault && pBtnOldDefault != this)
+ {
+ //
+ // Remove the BS_DEFPUSHBUTTON style from the other button
+ //
+ lStyle = ::WinQueryWindowULong(GetHwndOf(pBtnOldDefault), QWL_STYLE);
+
+ //
+ // Don't do it with the owner drawn buttons because it will reset
+ // BS_OWNERDRAW style bit too (BS_OWNERDRAW & BS_DEFPUSHBUTTON != 0)!
+ //
+ if ((lStyle & BS_USERBUTTON) != BS_USERBUTTON)
+ {
+ lStyle &= ~BS_DEFAULT;
+ ::WinSetWindowULong(GetHwndOf(pBtnOldDefault), QWL_STYLE, lStyle);
+ }
+ else
+ {
+ //
+ // Redraw the button - it will notice itself that it's not the
+ // default one any longer
+ //
+ pBtnOldDefault->Refresh();
+ }
+ }
+
+ //
+ // Set this button as the default
+ //
+ lStyle = ::WinQueryWindowULong(GetHwnd(), QWL_STYLE);
+ if ((lStyle & BS_USERBUTTON) != BS_USERBUTTON)
+ {
+ lStyle != BS_DEFAULT;
+ ::WinSetWindowULong(GetHwnd(), QWL_STYLE, lStyle);
+ }
+} // end of wxButton::SetDefault