Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Building Tree Ctrl into Dialog

Posted on 1998-09-17
2
Medium Priority
?
292 Views
Last Modified: 2013-11-20
Help ! I'm trying to build a tree control into a dialog. I can create such a control by "drawing" it in the dialog box then assigning a member variable to it and manipulating it using the dialog class and using the member variable to fill the tree with data - so far no problem !

But my app needs to be able to read a file containing tree structure data when it opens, the user can modify that data, then the updated data is saved on exit.

The problem is that in order to save the data I need access to the Serialise function of the control. I think this means that I need to create a separate new class based on CTreeCtrl. However, within that new class I cannot find a way of connecting it to the control which I have created in my dialog box, and no way of mapping its members.

Please can someone tell me how I can make "child" control classes such as CTreeCtrl work with a "parent" dialog class so that the dialog class is linking with the control class, and where I should be adding data to my control - within the Dialog class or the CTreeCtrl class. How are you supposed to implement these control classes?

Sorry if the question is a messy one  - ask for more details or tell me if I'm being an idiot !

Thank you,
Boedeker
0
Comment
Question by:boedeker
2 Comments
 
LVL 1

Accepted Solution

by:
girts063098 earned 520 total points
ID: 1322241
As I understood you want to create new class such as CMyTreeCtrl with new(your own) methods like LoadDataFromFile(). To do it you have to:
(you have already "drew" tree control in dialog box)
1.Create new class CMyTreeCtrl with CTreeCtrl as base class.
2.When assigning a member variable to it choose type - CMyTreeCtrl.
Now CMyTreeCtrl is the base class of tree control you "drew".
Now you can add your own methods to CMyTreeCtrl or override existing ones.

Girts.
0
 

Author Comment

by:boedeker
ID: 1322242
Thanks a lot Girt - I just needed to know how to map the member variable to my "child" class, so your answer is perfect !

Boedeker
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

972 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