06-02-2014 05:32 AM
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
06-02-2014 06:27 AM - edited 06-02-2014 06:28 AM
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
06-02-2014 09:58 AM
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
06-02-2014 10:05 AM
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.
06-02-2014 10:34 AM - edited 06-02-2014 10:38 AM
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 maintain
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.
06-02-2014 10:56 AM
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.
06-03-2014 05:18 AM
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.
06-03-2014 06:13 AM
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
06-03-2014 06:16 AM
Actually you can set the checkbox to OR with the new value, thus it wont be unchecked once it's checked.
/Y
06-03-2014 06:18 AM - edited 06-03-2014 06:21 AM
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.