LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to highlight all child items in a tree control?

I have a tree control and a boolean button. I want to use the button to select all (highlight) the child items in the tree control. I've seen CVI functions where you can set the active items, but such a function/method does not appear in LabVIEW.

 

Any clues?

"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

0 Kudos
Message 1 of 8
(3,850 Views)

Since tree controls don't support multi-item-selection, you cannot select multiple items.

This leaves the question if you want to 1) highlight the items just to display actual valid items or 2) if you want to use multiple items.

If 1) is correct, you should delete all items and insert programmatically only the ones valid. Leaving items which are not valid in the current context is not good programming style.

If 2) is correct, please read the first sentence again...

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 8
(3,848 Views)

I'm not sure which tree control you're using, but I'm using LabVIEW 8.2.1 and when you right click on the control, there is a selection mode section with the following options

  • 0 or 1 item
  • 1 item
  • 0 or more items
  • 1 or more items

The last two options allow you to select multiple items.

"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

0 Kudos
Message 3 of 8
(3,842 Views)

You are correct, i misread the last both options...

There is indeed no simple way to select child-items programmatically since you don't know if an item is "child" or "parent".

You can select multiple items by passing multiple values per propertynode, so if you generate a fitting array, the correct items are selected. Maybe this is a kind of workaround for you...

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 8
(3,837 Views)
I can programmatically get all the child items. My problem is actually showing them as selected in the control on the screen so that a person can then drag those items to another tree control.
"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

0 Kudos
Message 5 of 8
(3,830 Views)

Look at this piece of code:

 

 

 

If you can make sure, that the retrieved tags are the children, that should work for you, too.

 

hope this helps, 

Norbert 

Message Edited by Norbert B on 08-20-2008 10:57 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 8
(3,815 Views)

Hi settles,

 

Once you have all the children, you just need to set the value of the tree control to be an array of all the child tags.  Here's a screenshot of a VI that does this:

 

 

 

First I get all the tags, then I get the parent of each tag.  If the parent is a non-empty string, I add it to an array.  Then I write that array value to a local variable of the tree control.  Let me know if you have any questions on this method.  I believe the "All Tags" property I'm using was added in LabVIEW 8.0.

 

-D

Message Edited by Darren on 08-20-2008 10:58 AM
Message 7 of 8
(3,812 Views)
Thank you. I thought setting the value of the control actually change its contents.
"All truths are easy to understand once they are discovered; the point is to discover them." -- Galileo Galilei

0 Kudos
Message 8 of 8
(3,803 Views)