NavinKaushik
asked on
Find function in CTreeCtrl
Hi,
There is tree control. Each node having some text.
I want to check whether "abc" string exist in tree or not.
You can say I just want to use find functionality.
How can I do ?
There is tree control. Each node having some text.
I want to check whether "abc" string exist in tree or not.
You can say I just want to use find functionality.
How can I do ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
HTREEITEM GetMatchingItem(CString& strMatch, CTreeCtrl* ctlTree, HTREEITEM start /*= NULL*/)
{
HTREEITEM item, child;
if (start == NULL)
item = ctlTree->GetRootItem();
else
item = start;
while ((item != NULL) && (ctlTree->GetItemText(item
{
child = ctlTree->GetNextItem(item,
child = GetMatchingItem(strMatch, ctlTree, child);
if (child != NULL)
return child;
item = ctlTree->GetNextItem(item,
}
return item;
}
This was typed in on the fly, so watch out for bugs.
Hope this helps.