From 46a414097b1f65eb4e2a308f226951d96c30b997 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 5 Sep 2014 12:46:38 +0000 Subject: [PATCH] Always disable "Back" wxWizard button for the starting page. Do it even if the start page has a previous page (e.g. because the wizard has been started in the middle for some reason). Closes #16535. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77545 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/generic/wizard.h | 1 + src/generic/wizard.cpp | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 4659001928..9d90e57ef6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -77,6 +77,7 @@ All (GUI): - Use native renderer for drawing check boxes in wxPropertyGrid (Eran Ifrah). - Fix drawing custom colours of wxEnumProperty items in wxPG (Artur Wieczorek). - Add wxBitmap ctor from wxCursor. +- Always disable wxWizard "Back" button on the starting page (pmgrace30). wxGTK: diff --git a/include/wx/generic/wizard.h b/include/wx/generic/wizard.h index d8c9643b08..8d6b64936d 100644 --- a/include/wx/generic/wizard.h +++ b/include/wx/generic/wizard.h @@ -124,6 +124,7 @@ protected: // wizard state wxWizardPage *m_page; // the current page or NULL + wxWizardPage *m_firstpage; // the page RunWizard started on or NULL wxBitmap m_bitmap; // the default bitmap to show // wizard controls diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index bfd140a7a9..f3c47f3670 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -271,6 +271,7 @@ void wxWizard::Init() { m_posWizard = wxDefaultPosition; m_page = NULL; + m_firstpage = NULL; m_btnPrev = m_btnNext = NULL; m_statbmp = NULL; m_sizerBmpAndPage = NULL; @@ -620,7 +621,7 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) // and update the buttons state - m_btnPrev->Enable(HasPrevPage(m_page)); + m_btnPrev->Enable(m_page != m_firstpage); const bool hasNext = HasNextPage(m_page); const wxString label = hasNext ? _("&Next >") : _("&Finish"); @@ -687,6 +688,8 @@ bool wxWizard::RunWizard(wxWizardPage *firstPage) { wxCHECK_MSG( firstPage, false, wxT("can't run empty wizard") ); + m_firstpage = firstPage; + // can't return false here because there is no old page (void)ShowPage(firstPage, true /* forward */);