Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MFC CTreeCtrl Surgeon required!

Status
Not open for further replies.

sntpaul

Programmer
Jan 31, 2003
4
GB
hello,

i have a heirarchical set of data which is created from the following simplified class defintion:

class Extent
{
vector<Surface*>m_pSurfaces;
vector<Extent*>m_pExtents;
};

CMyAppDoc.cpp:

Extent *globalExtent=new Extent();
...

as can be seen: extents can have surfaces, and other extents.

the best way to represent this data is to use a CTreeCtrl class. this appears in a dialog with add surface, add extent, remove item buttons. i have never programmed such a complex data structure with a tree-view before and am having difficulty acquiring pointers to my data objects when they are selected in the tree view. every item in the tree view corresponds to an item in the globalExtent data heirarchy.

one way to get the pointer i thought would be to associate a HTREEITEM to each surface and extent - that way, when a CTreeCtrl item was selected i could use GetSelectedItem to get the selected HTREEITEM and search my globalExtent heirarchy for a match. This would not be a good idea though due to the search required - a large globalExtent heirarchy will require a time-consuming search.

I wondered if anyone had come across a similar situation and if so how they solved the problem.

Any help is grately appreciated.

Thanks,
Paul.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top