ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to programmatically select items in a tree

Solved!
Go to solution

Hi,

 

I am looking to persist the tree selection in my application (save to a file on close, load from the file on open), but I cannot figure out how to programmatically select an item in a tree on load.  I would like to select the item as well as have it highlighted as is the usual behaviour if selecting via mouse.

 

I have tried writing to the "ActiveItemTag" property, but this does not work.  Any ideas?

0 Kudos
Message 1 of 4
(7,274 Views)
Solution
Accepted by AK01

AK01,

 

Try the "Value" property.  The value of a tree control is the tag that is currently selected, so setting the Value to the appropriate tree tag will highlight that item.

 

Chris M 

Message 2 of 4
(7,267 Views)

Hai,

 

"Value" Property hightlights the tree item given as input.  It is a string data type and hence wire the element tag to highlight that element.  If the "selection mode" is set to "1 or more items" then wire a 1d string array to high light multiple items.

 

Hope it helps.

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
Message 3 of 4
(7,243 Views)
Thanks, guys, that works perfectly 🙂
0 Kudos
Message 4 of 4
(7,208 Views)