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);