I sort of stumbled upon this solution to the problem of sharing data between property sheet pages, particularly for making a summary page. Basically, you give your page object a pointer to the sheet it is attached to - you can then access data for other pages through member vars.
I was doing this in a wizard, using classes derived from CPropertySheetEx and CPropertyPageEx, but it should work for all sheet/page applications (I think..).
In the page class header, add the following...
An identifier for the sheet class before the start of the page class definition, eg:
A public member variable to hold a pointer to your sheet class, eg:
and finally declare your sheet class as friend:
friend class CWizardSheet;
(you should also probably be good and initialise the pointer to NULL in the class constructor)
When you construct the sheet object to be displayed, set the page class member variable for each page you want to be given access:
Returning -1 and zero make sense to me, it is the dialog identifier that I am having problems with. I first thought they wanted the resource ID but this causes the program to blow up. Looking around to see exactly what the dialog identifier is defined as I find nothing.
Has anyone got this to work ? What have you returned ?
m_Page1.m_psp.dwFlags &= ~PSP_HASHELP;
m_Page2.m_psp.dwFlags &= ~PSP_HASHELP;
m_Page3.m_psp.dwFlags &= ~PSP_HASHELP;
m_Page4.m_psp.dwFlags &= ~PSP_HASHELP;
// must be done on all pages or the
// help button will be disabled but visible
I have created a wizard of 5 pages using the MFC AppWizard(exe). However, I do not know how to exchange data between the pages of the wizard. I tried the Foreign Class and Foreign Variables to use a certain variable in a certain class, however, I'm getting an error message on runtime.
Please, any hint will be appreciable and useful.
Thanks in advance.
Let us say that I have a four-page wizard. Each of the first three pages has an edit box for accepting a number from the user. On the last page I have a read-only edit box or a static text control to display the sum of the entries to the three edit boxes on the previous pages. I also have on the last page, a push button labeled "Sum", which when clicked should cause the sum to be displayed without terminating the wizard. Can anyone tell me how to implement this? Of course, the actual situation I am confronting is a lot more complex, but if I am told how to implement the simplified version as described above, I will be able to handle the actual case.
Thanks to anyone who can help me. I am using Visual C++ 6.0.
Last page to summarize data from other pages.
Posted by MeghaKhosla
on 05/26/2005 02:58am
I tried this by declaring a staic variable in PropertySheet class and gather data from each page and then finally display on the last page by transfering the data from variable to control in the OnInitDialog()function of the last page .