Editing the labels
-
CTreeCntrl or CTreeCtrl? :) Anyway, check [this] tutorial on using CTreeCtrl. For editing labels, SetItemText should work?? What problem are you facing?
-
Not adding items to the CTreeCntrl. My problem is that , i have an editable tree, ie, i have checked the edit labels option.i want to know how to accept the label change on the tree. Means how to set the changed label?
I am sorry if I could not get you but do you mean how to edit the labels from user point of view? If it's so, click on the item to select it and then single click again and an in-place edit box will open. :doh: If you mean as a programmer, then you get BeginLabelEdit and endlabel edit messages, you can get the item text, set the item text, get current selection etc etc? something like
void CMyTreeCtrl::OnEndLabelEdit(LPNMHDR pnmhdr, LRESULT *pLResult)
{
TV_DISPINFO *ptvinfo;
ptvinfo = (TV_DISPINFO *)pnmhdr;
if (ptvinfo->item.pszText != NULL)
{
ptvinfo->item.mask = TVIF_TEXT;
SetItem(&ptvinfo->item);
}
*pLResult = TRUE;
} -
I am sorry if I could not get you but do you mean how to edit the labels from user point of view? If it's so, click on the item to select it and then single click again and an in-place edit box will open. :doh: If you mean as a programmer, then you get BeginLabelEdit and endlabel edit messages, you can get the item text, set the item text, get current selection etc etc? something like
void CMyTreeCtrl::OnEndLabelEdit(LPNMHDR pnmhdr, LRESULT *pLResult)
{
TV_DISPINFO *ptvinfo;
ptvinfo = (TV_DISPINFO *)pnmhdr;
if (ptvinfo->item.pszText != NULL)
{
ptvinfo->item.mask = TVIF_TEXT;
SetItem(&ptvinfo->item);
}
*pLResult = TRUE;
}