]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix setting the parent of wxProgressDialog.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 30 Nov 2011 10:48:05 +0000 (10:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 30 Nov 2011 10:48:05 +0000 (10:48 +0000)
Don't call GetParentForModalDialog() with wxProgressDialog style, this doesn't
work as it expects the window style.

Do call SetParent() when using the native MSW implementation as the wx-level
parent is not used then.

Closes #13706.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69874 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/progdlgg.cpp
src/msw/progdlg.cpp

index fb454b79530c3ec0458705cb2d5696b2ccc641a3..129cd47b39920e76c7a2a91e33a9599e5aa4c86c 100644 (file)
@@ -153,9 +153,12 @@ void wxGenericProgressDialog::Create( const wxString& title,
                                       wxWindow *parent,
                                       int style )
 {
-    wxDialog::Create(GetParentForModalDialog(parent, style), wxID_ANY, title);
+    // Notice that GetParentForModalDialog() needs the dialog window style, not
+    // our wxProgressDialog-specific style.
+    wxWindow* const
+        realParent = GetParentForModalDialog(parent, GetWindowStyle());
+    wxDialog::Create(realParent, wxID_ANY, title);
 
-    SetParent( GetParentForModalDialog(parent, style) );
     SetTitle( title );
 
     SetMaximum(maximum);
index 0cb869aa2ef91d557c41f246e3cd424e463e3c98..f51c87990139567a8d123edbe99178283fc95928 100644 (file)
@@ -316,6 +316,7 @@ wxProgressDialog::wxProgressDialog( const wxString& title,
 #ifdef wxHAS_MSW_TASKDIALOG
     if ( HasNativeTaskDialog() )
     {
+        SetParent(GetParentForModalDialog(parent, GetWindowStyle()));
         SetMaximum(maximum);
 
         Show();