08-20-2008 07:55 AM
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?
08-20-2008 08:08 AM
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
08-20-2008 08:25 AM
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
The last two options allow you to select multiple items.
08-20-2008 09:01 AM
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
08-20-2008 09:37 AM
08-20-2008 10:56 AM - edited 08-20-2008 10:57 AM
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
08-20-2008 10:58 AM - edited 08-20-2008 10:58 AM
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
08-20-2008 12:11 PM