LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

[CVI2013] Manage a Tree control

Hello,

 

I have a Tree control, and a function. In this function I want to update few names : 

Here is a pic : 

Tree.png

What I want to do is to change the name "Cluster" to for example "Test1", then the second "Cluster" to "Test2, ...

 

Besides, before doing this, I just want to keep only one "Network", how can I delete the second ? 😕

The first "Network" name I need to change it too. 

 

Did someone have an example please ? I can't post the my code. 

0 Kudos
Message 1 of 6
(3,900 Views)

Another simple question : How can I get the Cluster's items indexs ? (Note: the number of sub-Items under each Cluster is variable and can change). 

0 Kudos
Message 2 of 6
(3,897 Views)

Finding elements in a tree is not a trivial task in that you need to indexes and relation between elements in a non-intuitive way (at least not intuitive to me).

I suggest you to study the examples related to the tree control: "treesearch" is the most useful you can find, as it permits you to experiment with different kind of searches and understand how search parameters work in a real tree.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 6
(3,876 Views)

Hello Houssam_AZ!

 

There is CVI sample program that ships with CVI, which contains source code from where you can learn how to search, identify andh change specific items in a tree control.

The sample is located at <CVI Installation Directory>\samples\userint\treesearch.cws

 

Best regards!

- Johannes

0 Kudos
Message 4 of 6
(3,871 Views)

Thank you RB and JT.

I'm trying to undestand that code example.

0 Kudos
Message 5 of 6
(3,861 Views)

Basically you use GetTreeItem or some GetTreeItemFromXxx function to obtain the index of the element found (or -1 in case no item is found). The crucial point is that you can give a starting element and find other items related to it (siblings, childs, descendents or ancestors), with an optional additional selection by state of the items: what the example can show better than an explanation is what those relations stand for and how states are managed.

 

Coming to the second part of your question, deleting an item is done by DeleteListItem function (severl list-related functions can be used on tree: see the control help for additional infos. This help page is significantly better than in previous versions): keep in mind that if you delete an item that has descendents, all them are removed too from the tree.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 6
(3,850 Views)