Click here to Skip to main content
15,910,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone!

I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.

I have a tree view control created in dialog via resource editor.

I have to find a node which text label is the same as the string variable and select it.

A small example:
--------------------------------------

TREE VIEW CONTROL WITH NODES

+ First node
|
|__ Second node
.
.
.

char[10] test = "Second node"; // char variable

---------------------------------------------------------

Since in the above example test variable and second node have the same text I should select programmatically the second node.

That is my problem, so my question is:

How do I do that ?

I work in MS Visual Studio Express 2008, on Windows XP, in C++, using pure WIN32 API.

That would be all, again I thank everyone who tries to help.Thank you very very much!
Posted
Updated 22-Jul-13 4:29am
v2
Comments
Joezer BH 22-Jul-13 11:05am    
What seems to be the problem then?
Have you tried anything?
MyOldAccount 22-Jul-13 11:08am    
I have successfully found a matching node, now I just need to select it.
Any suggestions ?

See CP's nice article on the subject, it's an oldie but it looks ok:
Using TreeControl (TreeView) under Win32 API[^]

Hope it helps!

Cheers,
Edo
 
Share this answer
 
Comments
MyOldAccount 22-Jul-13 11:32am    
I know about that article, I have found it myself as well!
There is no " magic pill ", I had to traverse through the nodes and compare the strings, to find a matching node.

Luckily, the treeview's number of nodes and child nodes is small.

As for selection of a matching node, I have just used TreeView_SelectItem( ... ) macro.

[enhzflep EDIT]: Solution here: find treeview node by which label equals string variable[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900