-
CTreeCtrl
Hi,
I insert objects address as lParam in CTreeList and when I try to get it at OnDblclk.
by this code
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
TVITEMA* pItemNew = &pNMTreeView->itemNew;
CCityOb* pCity = (CCityOb*) pItemNew->lParam;
pCity don't return as vaild object, any one can help me
thanks.
-
Re: CTreeCtrl
I had the same problem.
This is a little tricky but works:
OnItemDoubleClick()
{
HTREEITEM item;
item = m_Tree.GetSelectedItem();
//...
}
This way you can know the item by text using
CString ItemText = m_Tree.GetItemText(item)
but i don't remember if the HTREEITEM structure allows you to get the index.
Hope it helps.
-
Re: CTreeCtrl
how do you poke the data in there?
-
Re: CTreeCtrl
When inserting the item in the control use this
CCityOb* pCity = new CCityOb;
//call any methods or initialize CCityOb
//and then
...->lParam = pCity;
where lParam is from the item u r inserting.