Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using propertysheets

Posted on 1999-07-05
7
Medium Priority
?
166 Views
Last Modified: 2013-11-20
i have wroten a class CMyPropertySheet und it should have 5 Pages ..laso 5 classes: CMypropertypage1..5
i want to define variables in CMypropertysheet so , that i can access to this variables from all my class CMyPropertypage1 until CMyPropertypPage5
i want to read an write in this variables from a funktion, witch is written in CMyPropertypage1.
can someone help me :-)
0
Comment
Question by:khf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
7 Comments
 
LVL 23

Expert Comment

by:naveenkohli
ID: 1308915
This question seems to be dulicate.... Ask cutomer service to delete this question. I have already proposed answer..
0
 

Accepted Solution

by:
dansko earned 100 total points
ID: 1308916
There are a couple of calls you can make to do this.

First, use GetParent() to get the parent property sheet. For example, in one of the CMyPropertyPage1 functions, where you want to call one of the variables located in the CMyPropertySheet, do the following:

CMyPropertySheet *parent = (CMtPropertySheet *)GetParent();

You can then use that pointer to reference the variables, i.e.:

parent->m_variable1 = 5;
parent->m_variable2 = "New Value";

etc.

2. Perhaps you are already doing this, but inside the parent propert sheet (CMyProperySheet) have some variables that reference the property sheet pages:

CMyPropertypage1  m_page1;
CMyPropertypage2 m_page2;
etc.

Then, in the property sheet constructor add all of these pages using the AddPage(); method.

3. Now, whenever you need to change the property sheet's variable using the CMyPropertypage1's methods, you can do something like this:

CMyPropertySheet *parent = (CMtPropertySheet *)GetParent();
parent->m_page1.ChangeVariables();

4. Last, you might want to consider some design issues. Since I don't know what exactly you are trying to do, this is a shot in the dark, but you might want to consider placing all variables that can be changed by any of the pages in the CMyPropertySheet class. You should also have any member functions that change those variables located in the CMyPropertySheet class, rather than in one of the pages.

Hope this helps!
0
 

Author Comment

by:khf
ID: 1308917
i thank you for the solution
but i have now only problems because i can´t call the funktion Oninitdialog() of m_Page2 from the class CMyPropertypage (m_Page1) because it defined as protected method in CMyPropertypage2
my Problem:
i have written a class for a dialog who communicate with a dokument.
this dialog have 5 listboxes and the buttons for datatransfer.
i have had a Method  Oninitdialog() for the dialog.
now i want to make 5 Propertypages and delete the listboxes and add a propertysheet for this pagesin this dialog.
when i change something now in one of CMYPropertypage , i want the OnInitdialog() of each Page be called.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:khf
ID: 1308918
i thank you for the solution
but i have now only problems because i can´t call the funktion Oninitdialog() of m_Page2 from the class CMyPropertypage (m_Page1) because it defined as protected method in CMyPropertypage2
my Problem:
i have written a class for a dialog who communicate with a dokument.
this dialog have 5 listboxes and the buttons for datatransfer.
i have had a Method  Oninitdialog() for the dialog.
now i want to make 5 Propertypages and delete the listboxes and add a propertysheet for this pagesin this dialog.
when i change something now in one of CMYPropertypage , i want the OnInitdialog() of each Page be called.
0
 

Author Comment

by:khf
ID: 1308919
i thank you for the solution
but i have now only problems because i can´t call the funktion Oninitdialog() of m_Page2 from the class CMyPropertypage (m_Page1) because it defined as protected method in CMyPropertypage2
my Problem:
i have written a class for a dialog who communicate with a dokument.
this dialog have 5 listboxes and the buttons for datatransfer.
i have had a Method  Oninitdialog() for the dialog.
now i want to make 5 Propertypages and delete the listboxes and add a propertysheet for this pagesin this dialog.
when i change something now in one of CMYPropertypage , i want the OnInitdialog() of each Page be called.
0
 

Author Comment

by:khf
ID: 1308920
i thank you for the solution
but i have now only problems because i can´t call the funktion Oninitdialog() of m_Page2 from the class CMyPropertypage (m_Page1) because it defined as protected method in CMyPropertypage2
my Problem:
i have written a class for a dialog who communicate with a dokument.
this dialog have 5 listboxes and the buttons for datatransfer.
i have had a Method  Oninitdialog() for the dialog.
now i want to make 5 Propertypages and delete the listboxes and add a propertysheet for this pagesin this dialog.
when i change something now in one of CMYPropertypage , i want the OnInitdialog() of each Page be called.
0
 

Author Comment

by:khf
ID: 1308921
i thank you for the solution
but i have now only problems because i can´t call the funktion Oninitdialog() of m_Page2 from the class CMyPropertypage (m_Page1) because it defined as protected method in CMyPropertypage2
my Problem:
i have written a class for a dialog who communicate with a dokument.
this dialog have 5 listboxes and the buttons for datatransfer.
i have had a Method  Oninitdialog() for the dialog.
now i want to make 5 Propertypages and delete the listboxes and add a propertysheet for this pagesin this dialog.
when i change something now in one of CMYPropertypage , i want the OnInitdialog() of each Page be called.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question