+
+ // Store it for Dismiss() but ensure that the pointer is reset to NULL
+ // when the dialog is destroyed on leaving this function.
+ m_dlg = dlg.get();
+ wxON_BLOCK_EXIT_NULL(m_dlg);
+
+ // Restore the previously selected page, if any.
+ if ( m_currentPage != -1 )
+ dlg->SelectPage(m_currentPage);
+
+ // Don't remember the last selected page if the dialog was cancelled.
+ if ( dlg->ShowModal() != wxID_CANCEL )
+ m_currentPage = dlg->GetSelectedPage();