From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Create checkboxes programmatically

Hello LabView Community

 

I have a 2D Array of Strings that will correspond to labels of checkboxes that need to be displayed. Is there a way to create and precheck those checkboxes programmatically? The ones that need to appear checked are in another array of Strings. To explain myself better, here there is an example

 

2D Array of Strings with the labels for the checkboxes

Strings = { Fruits [apple, mango, cherry.....], Vegetables [eggplant, tomato, potato, lettuce....], Spices [pepper, curry...] }

 

Array with checkboxes that need to be displayed checked

Strings = [apple, eggplant, curry...]

 

I will like to do it programmatically because the values of both arrays can change depending on the configuration. Thank you very much in advance for the answer.

0 Kudos
Message 1 of 4
(2,638 Views)

Hi Ana,

 

create a cluster of a checkbox and a string.

Create an 2d array of those clusters.

Fill the strings as needed from your string array.

Set the checkboxes as needed from your other array…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(2,636 Views)

Hello GerdW,

 

Would you mind posting at least a screeshot with an example of how I could do that or some tutorial that would help to understand it better? I am new to LabView and some things are not quite clear to me. Thank you very much for your help.

 

Best regards,

Ana

0 Kudos
Message 3 of 4
(2,570 Views)

Hi Ana,

 

which of those 4 steps are a problem to you?

 

After the first two of them you should get (something) this:

check.png

As you want your use to (de)select the checkboxes you need to make your array a control (LabVIEW basics!).

To set values in a control you should use a local variable (LabVIEW basics!)…

 

If you have problems with those basics you should take the free online resources offered by NI for beginners!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(2,564 Views)