Click to See Complete Forum and Search --> : How exchange data among properpages


AndrewZhang
May 10th, 1999, 09:30 PM
Hello everyone:
In my project,I met the following problem.
I use a propersheet containing sevaral pages and I need the data exchangement among all the pages.That is to say when the data in one page has been changed,other pages which using this data must be update.
If you like to help me solve this problem,please mail me or reply my problem.
Thanks a lot!

xjtuandrew@hotmail.com

andrew

Bob Clarke
May 10th, 1999, 11:24 PM
1. Assume that CMainSheet is the property sheet and CPageOne and CPageTwo are pages.
2. In the header files for CPageOne and CPageTwo, #include CMainSheet.h, and declare this variable:

CWnd* m_pMainSheet;

3. Using Class Wizard, map OnSetActive for CPageOne and CPageTwo.

4. In the OnSetActive() handlers for CPageOne and CPageTwo, add this call:

m_pMainSheet = GetParentOwner();

5. For any methods or data that must be visible to all pages, make them public or provide accessor methods in CMainSheet.

6. Call the methods from CPageOne or CPageTwo using pointer notation, casting the m_pMainSheet pointer from CWnd* to CMainSheet*, like this:

((CMainSheet*)m_pMainSheet)->doSomeFunction();