Ticket #13603: demonstrate-wizard-first-page-pb.patch

File demonstrate-wizard-first-page-pb.patch, 2.7 KB (added by aasselin, 7 years ago)

patch to the sample demonstrating the problem when starting on second page (added an option in options menu)

  • wizard.cpp

     
    6161    Wizard_RunModeless,
    6262
    6363    Wizard_LargeWizard,
    64     Wizard_ExpandBitmap
     64    Wizard_ExpandBitmap,
     65    Wizard_StartOnSecondPage
    6566};
    6667
    6768// ----------------------------------------------------------------------------
     
    9293    void OnWizardFinished(wxWizardEvent& event);
    9394
    9495private:
     96
    9597    // any class wishing to process wxWidgets events must use this macro
    9698    DECLARE_EVENT_TABLE()
    9799};
     
    105107public:
    106108    MyWizard(wxFrame *frame, bool useSizer = true);
    107109
    108     wxWizardPage *GetFirstPage() const { return m_page1; }
     110    wxWizardPage *GetFirstPage() const { return m_firstPage; }
    109111
    110112private:
    111     wxWizardPageSimple *m_page1;
     113    wxWizardPage *m_firstPage;
    112114};
    113115
    114116// ----------------------------------------------------------------------------
     
    400402        SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
    401403
    402404    // a wizard page may be either an object of predefined class
    403     m_page1 = new wxWizardPageSimple(this);
     405    wxWizardPageSimple *page1 = new wxWizardPageSimple(this);
    404406
    405     /* wxStaticText *text = */ new wxStaticText(m_page1, wxID_ANY,
     407    /* wxStaticText *text = */ new wxStaticText(page1, wxID_ANY,
    406408             wxT("This wizard doesn't help you\nto do anything at all.\n")
    407409             wxT("\n")
    408410             wxT("The next pages will present you\nwith more useless controls."),
     
    419421
    420422    // this page is not a wxWizardPageSimple, so we use SetNext/Prev to insert
    421423    // it into the chain of pages
    422     wxCheckboxPage *page2 = new wxCheckboxPage(this, m_page1, page3);
    423     m_page1->SetNext(page2);
     424    wxCheckboxPage *page2 = new wxCheckboxPage(this, page1, page3);
     425    page1->SetNext(page2);
    424426    page3->SetPrev(page2);
    425427
    426428    if ( useSizer )
    427429    {
    428430        // allow the wizard to size itself around the pages
    429         GetPageAreaSizer()->Add(m_page1);
     431        GetPageAreaSizer()->Add(page1);
    430432    }
     433
     434    // Enable scrolling adaptation
     435    if (frame->GetMenuBar()->IsChecked(Wizard_StartOnSecondPage))
     436        m_firstPage = page2;
     437    else
     438        m_firstPage = page1;
    431439}
    432440
    433441// ----------------------------------------------------------------------------
     
    448456    wxMenu *menuOptions = new wxMenu;
    449457    menuOptions->AppendCheckItem(Wizard_LargeWizard, wxT("&Scroll Wizard Pages"));
    450458    menuOptions->AppendCheckItem(Wizard_ExpandBitmap, wxT("Si&ze Bitmap To Page"));
     459    menuOptions->AppendCheckItem(Wizard_StartOnSecondPage, wxT("Start on Se&cond Page"));
    451460
    452461    wxMenu *helpMenu = new wxMenu;
    453462    helpMenu->Append(Wizard_About, wxT("&About...\tF1"), wxT("Show about dialog"));