Click to See Complete Forum and Search --> : Wizard (PropertySheet)


Kishore Kumar
May 21st, 1999, 09:49 AM
Hello,
I am Working in VC++ Project, New to VC++, My Problem is
I have created a Wizard using CPropertySheet, it is having 8 Pages, It is working fine. My problem is

1) I want to Skip 5th page depending on the checkbutton is checked which is on the 4 th Page. and also when user presses Back on the 6th Page then 4th Page should be activated.

2) I want to set the Caption for perticular page at runtime. I used SetWindowText("Caption");

, Its not working
Please Kindly help me.

Kishore Kumar D
Mail ID : KishoreKumar@India.com
Bangalore.
India.

Simon Rose
May 21st, 1999, 03:36 PM
Hi,

To skip a page, you could try the following:

1. Overide OnWizardNext in Page 4 property page.
2. If your checkbutton is checked:

CPropertySheet *pParent = (CPropertySheet *)GetParent();

if(pParent)
pParent->SetActivePage(5); //might be 6 (0 based?)




Hope this helps,

Simon

May 21st, 1999, 05:40 PM
I had the same problem and I wanted to get other buttons and a picture on this Wizard... so I created a CDialog object and on it a CPropertySheet object (see http://www.codeguru.com/propertysheet/inside_dialog.shtml). Now everything works fine.. I've the pages of the CPropertySheet and by the functions of the CDialog I can select every page I want... (not only from 1 to 2 ...)

Kishore Kumar
May 22nd, 1999, 12:08 AM
Hello Simon Rose,
Thanks for helping, but You have answered only the First Part. Please answer the second Part. I am specifying the problem clearly below :

In Wizard I want to Take the details for n number of customers ( n < 4). I am using four Instances of same PropertyPage class. I want to set the Caption for each page at runtime in the event OnSetActive();

depending on the instance of customer. I used SetWindowText(str) ;

in OnSetActive();

its not working.
please help me.




Kishore Kumar D
Bangalore.
India.

Simon Rose
May 22nd, 1999, 11:38 AM
Hi,

I have looked into a few ways of doing caption changing, none of which seem to work, so I'm not sure how it's done, sorry. I am sure it must be possible though.

I tried in OnSetActive of the property page:

CPropertySheet *pParent = (CPropertySheet *)GetParent();
pParent->SetTitle(blahdy blah);



and

m_psh.dwFlags |= PSH_USETITLE;
m_psh.pszTitle = blahdy blah;



but all to no avail, so I am stumped.

Sorry,

Simon

Kishore Kumar
May 24th, 1999, 12:58 AM
Hello Simon,
Thanks for reply.But in the code m_psh.dwFlags |= PSH_USETITLE;
m_psh.pszTitle = "Hello" ;

VC++ 6.0 Compiler is returning an error saying that PSH_USETITLE is undefined. and also pszTitle is not a member of m_psh, but I found pszCaption. Please reply.

Kishore

Kishore Kumar D
Bangalore.
India.

Simon Rose
May 24th, 1999, 04:38 PM
Hi,

Sorry for the typo, my fault. Of course, I assume you are placing this code in your Property Page class(es). The actual code would want to be:

m_psp.dwFlags = PSP_USETITLE;
m_psp.pszTitle = "Hello";



When I tried this code though, it didn't work, but it's worth a try.

If you want to do it from the property sheet, in that class, you could try:

m_psh.pszCaption = "Hello";




Hope this helps,

Simon

Simon Rose
May 24th, 1999, 04:42 PM
Hi,

By the way, there is a better, more robust way to skip a page. Overiding OnWizardNext in the property page with the check button, simply do:

if(yourcheckbutton == true)
return RESOURCE_ID_OF_DIALOG_TEMPLATE_TO_SKIP_TO;
else
return CPropertyPage::OnWizardNext();



This works for going back too.

Simon