LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to dynamically create checkboxes

Hello,

i need a vi with 40 or 80 checkboxes. The current way is to create a vi with 80 checkboxes and on startup i just make 40 of them invisible if needed.

Can this be done easier?

Is there way to just create a checkbox object and in a loop create the 40 boxes and pass the position on the panel to the objects?

Thanks for help

0 Kudos
Message 1 of 12
(4,752 Views)

You cant dynamically create checkboxes. You can create a 1D or 2D-array of checkboxes with the issue that if you want to show different texts they're all the same. If that's the case you'll need to use an array of clusters with checkboxes and a string as dynamic text.

After that it should be smooth sailing. 🙂

With an array you can change the number of rows shown by a property making "resizing" easy.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 12
(4,739 Views)

Hm, then how can this be easy done?

Now i have a panel with 80 separate checkboxes. (Using arrays is no alternative here as it does not look very nice and has no option to set labels)

 

This will be later a popup where user can click on the channels he wants to use. Then he closes the popup.

In the background the state of all checkboxes is stored in a global-array

 

The next time the popup is starting the global-array is used as an input and all already clicked checkboxes are now greyed out/disabled.

 

Is there any way to do this without wiring 10000000 icons and using 80 cases?

 

Thx for all help and ideas

0 Kudos
Message 3 of 12
(4,709 Views)

I think you may have misunderstood Yamaeda.

 

Create a Cluster which includes a checkbox and string control.

Use the string control as your dynamically assigned label.

 

Then build up an array of those clusters to get the same visual feel as presented in your VI.

 

You'll need to add an engine to scan through the array and determine which labels are selected and not selected.

0 Kudos
Message 4 of 12
(4,705 Views)

I think I would be using a Listbox with 0 or more as the selection mode and populating the Channel names from a config file.  Much MUCH easier to maintainSmiley Wink

 

If there are any logical relations (Groups of channels) I would use a Tree so the user has the option to select entire groups.  40 to 80 "Checkboxes" that must be individually clicked is just asking your user to come up with a rather nasty nick-name for you.


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 12
(4,698 Views)

An alternative if you are bent on just making checkboxes is to just create 80 and then programmatically make them visible / invisible as needed.  As a general rule I find I prefer arrays of controls, but arrays of references work too.

0 Kudos
Message 6 of 12
(4,692 Views)

I think the problem when using arrays is, that i cannot diable a single element in an array.

I need to disable the already selected checkboxes when starting again.

0 Kudos
Message 7 of 12
(4,654 Views)

Use an event structure and if clicked on an already active index, disregard it (in effect creating a disable). Or the other way around, make it a control and handle the setting of the tickbox the same way.

 

Though handling 80 controls sounds like a bad UI design, so what's the goal?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 12
(4,643 Views)

Actually you can set the checkbox to OR with the new value, thus it wont be unchecked once it's checked.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 12
(4,639 Views)

The goal is:

One system with 80 powersupplies

One PS = one checkbox

Up to 10 Groups and for each group user can select which powersupplies schould be used.

So user select group one -> Show 80 checkboxes -> click needed PS

Select group two -> Show 80 checkboxes where the already selected of group one are disabled

... and so on

 

Currently i created a reference of each box which are then al together saved in an array and can be easy handled. Only some start-work to create the array.

 

0 Kudos
Message 10 of 12
(4,637 Views)