ban
April 13th, 1999, 10:55 PM
Hi,
How can I store some information in Tree View control.
Thanks.
How can I store some information in Tree View control.
Thanks.
|
Click to See Complete Forum and Search --> : Need help with Tree View ban April 13th, 1999, 10:55 PM Hi, How can I store some information in Tree View control. Thanks. real name April 14th, 1999, 01:08 AM if you want remenber data with treectrl item look here pParam is pointer to my alocated structure TV_INSERTSTRUCT TreeCtrlItem; TreeCtrlItem.hParent = hParentItem; TreeCtrlItem.hInsertAfter = TVI_LAST; TreeCtrlItem.item.mask = /*TVIF_TEXT |*/ TVIF_PARAM; //TreeCtrlItem.item.pszText = pParam->m_pName; TreeCtrlItem.item.lParam = (long)pParam; HTREEITEM hLayTreeItem = m_TreeCtrl.InsertItem(&TreeCtrlItem); at program/window exit you must this date delete, for example delete((CHItemParam*)(m_TreeCtrl.GetItemData(hItem))); if you need store data in any m_TreeCtrl class member which is not visible but used for data storing only call (and text success) of m_TreeCtrl.Create before adding items maybe this helps you Jason Teagle April 14th, 1999, 02:33 AM Each tree node supports a DWORD value like a list box does, accessed using GetItemData() and SetItemData(). This could be used to point to a structure or class (created in memory) which holds the extra information you need for each node. If the data to be stored is small enough, such as an index into a list of functions to perform when the branch is selected, for example, then the information could simply be stored in the DWORD itself, i.e.: SetItemData(hItem,(DWORD)iFnIndex); Does this help? ban April 15th, 1999, 09:41 AM Thanks.Your suggestion did help me. ban codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |