LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get displayed text of an item inside the TreeView Control

Hi,
 
i tried to find out which method / property can be used to get the displayed string of an item
inside the treeview control. The tag itsself doesn't contains the identical string if
there are multiple items with the same string added to the treeview control. In this case there is
automaticaly added an underscore and an index by using the 'Add item to end' method.
I need this string to do an action in case of doubleclicking an item.
 
Could anyone provide an example how to get the displayed string of an item inside the treeview?
 
Regards,
Sunny 
0 Kudos
Message 1 of 28
(2,729 Views)

Hi Sunny

Maybe you could get a little bit help of the vis I attached in this thread:

http://forums.ni.com/ni/board/message?board.id=170&message.id=111138

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 28
(2,723 Views)

Hi Thomas,

your example is very nice and my problem can be shown with it very easily:

1. Create a duplicate item entry under the item 1.1.1 (e.g. change 1.1.1.2 to 1.1.1.1 too)

2. Run your VI and you will see that there is read 1.1.1.1_1 for the second item.

How can this be avoided?

Regards,

Sunny

 

 

 

 

 

0 Kudos
Message 3 of 28
(2,718 Views)

What you see in the tree is the item text. What you get in my vi is the item tag. The tag must be different in each node as this is used (I'm pretty sure about that) to identify the node. The text is just a graphical representation for the user. Here it doesn't matter if each node has the same text.

Could you describe a little bit more precise what you want to do? Double-click an item - and then?

I attach a little example how you could react on a double click.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 4 of 28
(2,716 Views)

Hi Thomas,

i want to use the treeview control to show datasets. Within these datasets the first column has not to be unique and there is no restriction not to use an underscore within the text. If i use the tag information i don't now wether the underscore is added by addNode function or if it is part of the specified value for this field within the database. I case of a doubleclick i want to open a file and the filename sholud be built using the displayed text of the selected treeview item.

How can this be managed?

Reagards,

Sunny

 

 

 

0 Kudos
Message 5 of 28
(2,708 Views)

How do you insert data into the tree? Manually or by using the tree-methods (Add Item; Add Item at end...)?

If you do it programmatically you can set the tag yourself.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 6 of 28
(2,706 Views)

There is no way to specify the separator for the 'Add Item at end' method, there is always used the '_' followed by an automatically created index. The treeview is filled by myself, but how can i establish any relationship between the item string and the item tag?

Reagrds

Sunny

 

 

0 Kudos
Message 7 of 28
(2,697 Views)

You mentioned something about a database previously.

I modified my example, to be filled programmatically. I could imagine that this is something that could help you.

If you just want to change the tag, you could use the corresponding method.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 28
(2,694 Views)

Hi,

i resolved my problem by manipulating the tag. If i add items to my treeview i use now the item string and a configurable speartor (e.g. ~) to create the string for the tag. If the tag already exists LabVIEW adds the '_' and an index. If i need the displayed string of an item i am always using only the first part of the tag string.

Thanks for your help!

Regards,

Sunny

 

 

0 Kudos
Message 9 of 28
(2,685 Views)

Hm - sounds as if've found a way, but are not yet really satisfied with the solution.

I'm still wondering, why you have problems concerning the tags. These should be unique - this makes it easier for you to handle the items.

So if you still are interested in a maybe better solution, explain what you want to do as exactly as possible. You mentioned kind of a link between database fields and tags, but did not really clearify it. It's always hard to help, if one just knows a part of the problem.

Thomas

 

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 10 of 28
(2,685 Views)