+ // make sure that we won't have BS_DEFPUSHBUTTON style any more if the
+ // focus is being transfered to another button with the same parent -
+ // otherwise, we could finish with 2 default buttons inside one panel
+ if ( (nMsg == WM_KILLFOCUS) &&
+ (GetWindowLong(GetHwnd(), GWL_STYLE) & BS_DEFPUSHBUTTON) )
+ {
+ wxWindow *parent = GetParent();
+ wxWindow *win = wxFindWinFromHandle((WXHWND)wParam);
+ if ( win && win->GetParent() == parent )
+ {
+ wxPanel *panel = wxDynamicCast(parent, wxPanel);
+ if ( panel )
+ {
+ panel->SetDefaultItem(this);
+ }
+ // else: I don't know what to do - we'll still have the problem
+ // with multiple default buttons in a dialog...
+ }
+ }