Disable or Enable Listbox and Tree Control Items in LabVIEW

Updated Aug 22, 2023

Reported In

Software

  • LabVIEW

Issue Details

I have a Listbox or Tree control in my LabVIEW VI's Front Panel, and I want to programmatically enable and disable the items inside so my users can't select them under specific circumstances.

Solution

According to the LabVIEW Help document: Disabling or Enabling Listbox and Tree Control Items, you can use the Disabled Items property to disable listbox items programmatically and the Active Item:Disabled? property to disable tree control items programmatically.

 

Here are some examples on how the code looks like for these functions:

 

Listbox Control

When using the Listbox control, you will use the Disabled Items property, which will take an array of indexes for the elements you want to disable. If you want all the elements to be enabled, then wire an empty array.

Note: Writing zero (0) into the input array elements will disable the element in the index zero (0), which will be the first one.

 

Tree Control

When using a Tree control, you will use the Active Item:Tag Property, and the Active Item:Disabled? properties. The first one will select the element you wish to modify, and the second one will set its state to enabled (FALSE) or disabled (TRUE).

Note: The Tag property should be on top of the Disabled? Property since property nodes execute top to bottom.