LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree tags selected lines out of order

Why is it that tree controls return the tags of the items selected in the order they are selected, whereas the listbox returns the row number of the items selected in numeric order? Is there any way to have a tree control return the selected items in the order they appear on screen?
 
Michael
0 Kudos
Message 1 of 7
(3,069 Views)
LabVIEW will not automatically return "original order" tags to another tree or other control.  You can program this yourself by knowing the parent,child relationship.  Could you attach an example of what you are trying to do.  I have some experience with the tree invoke nodes and may be able to help.
 
BTW: how are you setting the tags in the first place?
 
Chris Co
0 Kudos
Message 2 of 7
(3,061 Views)
I've attached an example illustrating how listboxes return selected items in order and trees do not. If you click on one of the bottom items, hold control, then click on one of the top items, the listbox will return the row numbers in numeric order whereas the tree returns the tags in the order you clicked them. It would be nice if the tree returned the tags in the order on the screen.
 
The actual code I am using the tree in is for a plot legend that allows users to select which graphs to make visible. I've already made a workaround that works fine, I was just trying to use a for loop that looked at each item in the listbox or tree and made a plot visible or invisible according to the items selected. However, this required selected items to be in order. I know this probably isn't a very common use of a tree, since I only deal with parents, but some features involving cell coloring when cells are deleted work very well for my application.
 
If the ordering is just how it is for trees, I guess I'll have to accept it....
 
Michael
0 Kudos
Message 3 of 7
(3,055 Views)
0 Kudos
Message 4 of 7
(3,051 Views)
Hi Miguelc,
 
If all you need is the order in the same manner as your listbok, look at the attachment, its really easy to implement.
0 Kudos
Message 5 of 7
(3,049 Views)
Good idea; its not quite what I need. If, for example, in your code you click on "you", hold the control button, then click on "Hello", in the listbox it will return "0,3" in a 1D array, but in the tree doing the same thing it will return "3,0" in a 1D array.
0 Kudos
Message 6 of 7
(3,045 Views)
Sort the array
0 Kudos
Message 7 of 7
(3,043 Views)