From: Vadim Zeitlin Date: Wed, 5 Jun 2002 22:37:24 +0000 (+0000) Subject: bring the parent of a wxFRAME_FLOAT_ON_PARENT frame to the top when deleting it as... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d6fb86a81c099a49304eebefd14c1f416aac21ca bring the parent of a wxFRAME_FLOAT_ON_PARENT frame to the top when deleting it as Windows doesn't do it automatically git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 14caef0e56..e65ef6c151 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -473,6 +473,19 @@ wxTopLevelWindowMSW::~wxTopLevelWindowMSW() if ( wxModelessWindows.Find(this) ) wxModelessWindows.DeleteObject(this); + // after destroying an owned window, Windows activates the next top level + // window in Z order but it may be different from our owner (to reproduce + // this simply Alt-TAB to another application and back before closing the + // owned frame) whereas we always want to yield activation to our parent + if ( HasFlag(wxFRAME_FLOAT_ON_PARENT) ) + { + wxWindow *parent = GetParent(); + if ( parent ) + { + ::BringWindowToTop(GetHwndOf(parent)); + } + } + // If this is the last top-level window, exit. if ( wxTheApp && (wxTopLevelWindows.Number() == 0) ) { @@ -757,10 +770,13 @@ long wxTopLevelWindowMSW::HandleNcActivate(bool activate) long wxTopLevelWindowMSW::MSWWindowProc(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam) { - if ( msg == WM_NCACTIVATE && HandleNcActivate(wParam != 0) ) + if ( msg == WM_NCACTIVATE ) { - // we processed WM_NCACTIVATE ourselves - return TRUE; + if ( HandleNcActivate(wParam != 0) ) + { + // we processed WM_NCACTIVATE ourselves + return TRUE; + } } return wxTopLevelWindowBase::MSWWindowProc(msg, wParam, lParam);