LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Howto have a control with a list of boolean checkboxes?

I need to give my users a list of tests to choose from and then do just the tests they selected. Each element in the list would have a string for the test name and a boolean checkbox for the user to select. I'd like to be able to iterate the list of string/boolean.

 

If I create a cluster and make an array out of it I can't seem to either drag the array of cluster into the multilistbox or set the value of MutiColumn ListBox programatically using the following code:

 

  • davidlan_0-1622524814535.png

 

 

I also managed to make a pretty MultiColumn ListBox but the check mark is just a picture and not a boolean:

 

  • davidlan_1-1622524814223.png

 

 

  • davidlan_2-1622524814208.png

 

How can I create a list of booleans with a ID string that I can iterate to see what is check and what is not?

My Blog Huy Dung Viet Nam Thay Pin iPhone - Thay Pin iPhone X - Thay Pin iPhone 11


0 Kudos
Message 1 of 6
(1,817 Views)

There is a checkbox front panel item and you could use and then use property node --> boolean text to return it's boolean text.

 

If you really want to use multicolumn listbox with checkboxes and single mouse button presses, then make 2 columns, one with test names and the other empty. When user clicks an item place a checkbox with property node--> item names and at the end of selection check which items have checkboxes.

 

 

PS: This is probably all way too convoluted so i'll wait for some knight to correct me 😄

0 Kudos
Message 2 of 6
(1,783 Views)

Hi davidian,

 


@davidlan wrote:

If I create a cluster and make an array out of it I can't seem to either drag the array of cluster into the multilistbox or set the value of MutiColumn ListBox programatically using the following code:

 

I also managed to make a pretty MultiColumn ListBox but the check mark is just a picture and not a boolean

 

How can I create a list of booleans with a ID string that I can iterate to see what is check and what is not?


You try to set the "Value" of the MCLB: that is something completely different than the text/checkboxes in your images! The "value" holds the selected rows…

You need to set the "items" of the MCLB - that property expects a 2D string array!

The checkbox is "just an image", but there are a lot of other images as well. (You can even add your own images to that list!)

Nobody forces you to add an array of only checkboxes so you can easily create an array of "checkboxes"/"no checkboxes" (aka "empty image") depending on your boolean array and show that instead…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 6
(1,776 Views)

test.png

seems to do what you need

 

the only problem is that if you have a value selected and would like to deselect it, you need to click out on another value and then back on the value you want to deselect.

0 Kudos
Message 4 of 6
(1,727 Views)

If you search for 'Listbox Multicolumn Listbox and Tree Item Selection', you'll find a library that does pretty close to what you need. Somehow my comment keeps getting deleted when I post a link.

0 Kudos
Message 6 of 6
(1,714 Views)