From: Vadim Zeitlin Date: Sat, 9 Aug 2008 22:44:35 +0000 (+0000) Subject: initialize the button label correctly if the same wizard is ran again X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7f3bf33a5988cdc9a549e1864589de3eb9313bd8 initialize the button label correctly if the same wizard is ran again git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55039 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index 74e205b81a..03b398e03f 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -558,10 +558,6 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) } - // we'll use this to decide whether we have to change the label of this - // button or not (initially the label is "Next") - bool btnLabelWasNext = true; - // remember the old bitmap (if any) to compare with the new one later wxBitmap bmpPrev; @@ -580,8 +576,6 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) m_page->Hide(); - btnLabelWasNext = HasNextPage(m_page); - bmpPrev = m_page->GetBitmap(); if ( !m_usingSizer ) @@ -651,15 +645,10 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) // and update the buttons state m_btnPrev->Enable(HasPrevPage(m_page)); - bool hasNext = HasNextPage(m_page); - if ( btnLabelWasNext != hasNext ) - { - if ( hasNext ) - m_btnNext->SetLabel(_("&Next >")); - else - m_btnNext->SetLabel(_("&Finish")); - } - // nothing to do: the label was already correct + const bool hasNext = HasNextPage(m_page); + const wxString label = hasNext ? _("&Next >") : _("&Finish"); + if ( label != m_btnNext->GetLabel() ) + m_btnNext->SetLabel(label); m_btnNext->SetDefault();