CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    [RESOLVED] Skip And Rotate View A Page In Property Sheet

    Hi,
    When i click the back button, I like to skip some old pages & rotate pages view in my property sheet.

    I have 5 pages, when i clicked the User button in my MainDlg the below function called like,
    User Button Clicked -> Page1 Opened
    Next Button Clicked
    -> Page2 -> Page3 -> Page4 -> Page5
    Back Button Clicked
    Page1 <- Page2 <- Page3 <- Page4 <- Page5

    This work done. working good.
    Code:
    void MainDlg:: onButtonUserClicked()
    {
       CSheet oSht(this);
       Page1 p1;
       Page2 p2.
       Page3 p3;
       Page4 p4;
       Page5 p5;
    
       oSht.AddPag(&p1, Page1::IDD);
       oSht.AddPag(&p2, Page2::IDD);
       oSht.AddPag(&p3, Page3::IDD);
       oSht.AddPag(&p4, Page4::IDD);
       oSht.AddPag(&p5, Page5::IDD);
    
       if(oSht.Domodal() == ID_WIZFINISH)
       {
          ::AfxmessageBox("Finished");
       }
       else
       {
       }
    }
    My requirement is,
    User Button Clicked -> Page1 Opened
    Next Button Clicked
    -> Page2 -> Page3 -> Page4-> Page5 -> Page1(Again called 1st page automatically - rotate pages view)
    Back Button Clicked(Cur Page loc is Page5)
    (Start the prev Process)Page5 <- Page1 <- (Skip the Page2 & 3)Page4 <- Page5

    Is this possible ?
    Regards,

    SaraswathiSrinath

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Skip And Rotate View A Page In Property Sheet

    Quote Originally Posted by saraswathisrinath View Post
    My requirement is,
    User Button Clicked -> Page1 Opened
    Next Button Clicked
    -> Page2 -> Page3 -> Page4-> Page5 -> Page1(Again called 1st page automatically - rotate pages view)
    Just add the page1 after page5:
    Code:
       oSht.AddPag(&p1, Page1::IDD);
       oSht.AddPag(&p2, Page2::IDD);
       oSht.AddPag(&p3, Page3::IDD);
       oSht.AddPag(&p4, Page4::IDD);
       oSht.AddPag(&p5, Page5::IDD);
       oSht.AddPag(&p1, Page1::IDD);
    And what do you mean by "rotate pages view"?
    Quote Originally Posted by saraswathisrinath View Post
    My requirement is,
    ...
    Back Button Clicked(Cur Page loc is Page5)
    (Start the prev Process)Page5 <- Page1 <- (Skip the Page2 & 3)Page4 <- Page5
    Remove page2 and page3!
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Re: Skip And Rotate View A Page In Property Sheet

    Quote Originally Posted by VictorN View Post
    Just add the page1 after page5:
    Code:
       oSht.AddPag(&p1, Page1::IDD);
       oSht.AddPag(&p2, Page2::IDD);
       oSht.AddPag(&p3, Page3::IDD);
       oSht.AddPag(&p4, Page4::IDD);
       oSht.AddPag(&p5, Page5::IDD);
       oSht.AddPag(&p1, Page1::IDD);
    And what do you mean by "rotate pages view"?
    This code working good for Next Button Click event.That is, Page5->Page1->Page2 ->.. etc

    How can i set the above code for Back Button Click Event(That is, I'm mentioned as Page Rotation When i click both next and back).

    That is, <-Page4<-Page5<-Page1<-Page2
    How is possible?

    Quote Originally Posted by VictorN View Post
    Remove page2 and page3!
    I like to do the below(ALL) process in the same button. That is,

    Next Button Click Event : Page1->Page2->Page3->Page4->page5->Page1->etc... Working Good.
    Back Button Click Event :
    Process 1 (Remove Pages 2 & 3) : <-Page1<-Page4<-Page5
    Process 2 (Page Rotation) : etc... <-Page1<-Page4<-Page5<-Page1<-Page4<-Page5

    Is Possible?
    Regards,

    SaraswathiSrinath

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Skip And Rotate View A Page In Property Sheet

    You could try to override CPropertyPage::OnWizardBack / CPropertyPage::OnWizardNext methods.
    See the example in https://msdn.microsoft.com/en-us/lib...(v=vs.60).aspx
    Victor Nijegorodov

  5. #5
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Re: Skip And Rotate View A Page In Property Sheet

    Quote Originally Posted by VictorN View Post
    You could try to override CPropertyPage::OnWizardBack / CPropertyPage::OnWizardNext methods.
    See the example in https://msdn.microsoft.com/en-us/lib...(v=vs.60).aspx
    Kindly find the sample code. I tried. But not solved.
    Attached Files Attached Files
    Regards,

    SaraswathiSrinath

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Skip And Rotate View A Page In Property Sheet

    Quote Originally Posted by saraswathisrinath View Post
    Kindly find the sample code. I tried. But not solved.
    What did you try?
    How did you try? (Sorry, but I don't see how you use CPropertyPage::OnWizardBack / CPropertyPage::OnWizardNext methods)
    Victor Nijegorodov

  7. #7
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Re: Skip And Rotate View A Page In Property Sheet

    Quote Originally Posted by VictorN View Post
    What did you try?
    How did you try? (Sorry, but I don't see how you use CPropertyPage::OnWizardBack / CPropertyPage::OnWizardNext methods)
    Code:
    // refer to CPropertyPage class members for a description of this function
    // return -1 to prevent changing pages
    // to move to a page other than the previous one, return the 
    // Dialog resource ID of the page to display
    LRESULT CNewWizPage::OnWizardBack()
    {
    	return 0;
    }
    if i change the return -1 to prevent changing pages - Working good.
    But i don't know to override CPropertyPage::OnWizardBack method.
    Regards,

    SaraswathiSrinath

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Skip And Rotate View A Page In Property Sheet

    It is a virtual method!
    So rather than use the same one (always returning zero) override it in the derived page classes to return the values these pages need (zero or the dialog resource ID of the page to go to)
    Victor Nijegorodov

  9. #9
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Skip And Rotate View A Page In Property Sheet

    In the override of OnWizardNext and/or OnWizardBack, just call CPropertySheet::SetActivePage() and pass the index of the page you need to set.

  10. #10
    Join Date
    Nov 2011
    Location
    India
    Posts
    333

    Thumbs up Re: Skip And Rotate View A Page In Property Sheet

    Thank You Mr.Victor & Mr.Arjay.

    I done. Its my long time pending work in my project. I wrongly thought its not possible.

    I'm very happy. Thank you once again
    Regards,

    SaraswathiSrinath

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured