From 7e083675342b17762735ef2223fb9d264d6fc937 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 5 Feb 2012 14:18:25 +0000 Subject: [PATCH 1/1] Ensure that the progress dialog parent is activated at the end under MSW. The progress dialog parent was supposed to become the new foreground window when the progress dialog was closed, but this didn't happen because m_parentTop was never set when the native progress dialog implementation was used under MSW. Fix this by explicitly calling the new SetTopParent() from its ctor. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/progdlgg.h | 4 ++++ src/generic/progdlgg.cpp | 7 +++++++ src/msw/progdlg.cpp | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/wx/generic/progdlgg.h b/include/wx/generic/progdlgg.h index 7646649d4f..4e3c3e183b 100644 --- a/include/wx/generic/progdlgg.h +++ b/include/wx/generic/progdlgg.h @@ -121,6 +121,10 @@ protected: // the dialog was shown void ReenableOtherWindows(); + // Set the top level parent we store from the parent window provided when + // creating the dialog. + void SetTopParent(wxWindow* parent); + // return the top level parent window of this dialog (may be NULL) wxWindow *GetTopParent() const { return m_parentTop; } diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index fad7b159f5..7f48ba31f3 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -146,12 +146,19 @@ wxGenericProgressDialog::wxGenericProgressDialog(const wxString& title, Create( title, message, maximum, parent, style ); } +void wxGenericProgressDialog::SetTopParent(wxWindow* parent) +{ + m_parentTop = GetParentForModalDialog(parent, GetWindowStyle()); +} + bool wxGenericProgressDialog::Create( const wxString& title, const wxString& message, int maximum, wxWindow *parent, int style ) { + SetTopParent(parent); + m_parentTop = wxGetTopLevelParent(parent); m_pdStyle = style; diff --git a/src/msw/progdlg.cpp b/src/msw/progdlg.cpp index 553c939fd2..8191f6b084 100644 --- a/src/msw/progdlg.cpp +++ b/src/msw/progdlg.cpp @@ -316,7 +316,7 @@ wxProgressDialog::wxProgressDialog( const wxString& title, #ifdef wxHAS_MSW_TASKDIALOG if ( HasNativeTaskDialog() ) { - SetParent(GetParentForModalDialog(parent, GetWindowStyle())); + SetTopParent(parent); SetPDStyle(style); SetMaximum(maximum); -- 2.45.2