From 11:00 PM CDT Friday, May 10 – 02:30 PM CDT Saturday, May 11 (04:00 AM UTC – 07:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(6,354 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
(6,347 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
(6,323 Views)
Thanks, guys, that works perfectly 🙂
0 Kudos
Message 4 of 4
(6,288 Views)