Solved

Building Tree Ctrl into Dialog

Posted on 1998-09-17
2
289 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
[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
2 Comments
 
LVL 1

Accepted Solution

by:
girts063098 earned 130 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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
canBalance challenge 34 111
scoreUp challenge 14 74
I could not set window to top 4 63
Problem to Office 1 67
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 …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Suggested Courses

751 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