]> git.saurik.com Git - wxWidgets.git/commitdiff
Pass last page in wxEVT_WIZARD_FINISHED event.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 13 Oct 2010 22:10:39 +0000 (22:10 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 13 Oct 2010 22:10:39 +0000 (22:10 +0000)
Delay resetting the wizard page to NULL when it terminates to allow
wxEVT_WIZARD_FINISHED event to carry the correct pointer to the last page.

Closes #12537.

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

src/generic/wizard.cpp

index fb34ae65116a7e41030800a97661c03627540c79..1b409230011a692ae50ea3f6c9ecfdeea1f28a0d 100644 (file)
@@ -563,11 +563,8 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
             m_sizerBmpAndPage->Detach(m_page);
     }
 
             m_sizerBmpAndPage->Detach(m_page);
     }
 
-    // set the new page
-    m_page = page;
-
     // is this the end?
     // is this the end?
-    if ( !m_page )
+    if ( !page )
     {
         // terminate successfully
         if ( IsModal() )
     {
         // terminate successfully
         if ( IsModal() )
@@ -582,12 +579,18 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
 
         // and notify the user code (this is especially useful for modeless
         // wizards)
 
         // and notify the user code (this is especially useful for modeless
         // wizards)
-        wxWizardEvent event(wxEVT_WIZARD_FINISHED, GetId(), false, 0);
+        wxWizardEvent event(wxEVT_WIZARD_FINISHED, GetId(), false, m_page);
         (void)GetEventHandler()->ProcessEvent(event);
 
         (void)GetEventHandler()->ProcessEvent(event);
 
+        m_page = NULL;
+
         return true;
     }
 
         return true;
     }
 
+    // notice that we change m_page only here so that wxEVT_WIZARD_FINISHED
+    // event above could still use the correct (i.e. old) value of m_page
+    m_page = page;
+
     // position and show the new page
     (void)m_page->TransferDataToWindow();
 
     // position and show the new page
     (void)m_page->TransferDataToWindow();