|
-
April 13th, 1999, 10:55 PM
#1
Need help with Tree View
Hi,
How can I store some information in Tree View control.
Thanks.
-
April 14th, 1999, 01:08 AM
#2
Re: Need help with Tree View
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
-
April 14th, 1999, 02:33 AM
#3
Re: Need help with Tree View
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?
-
April 15th, 1999, 09:41 AM
#4
Re: Need help with Tree View
Thanks.Your suggestion did help me.
ban
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|