04-05-2017 04:56 PM
I am fairly new to labview. I have a control panel with two LED switches that are a cluster. When one switch is pressed I want the other to be disabled and vice versa. I know I could do this with logic, but how do I access the switches since they are in a cluster?
04-05-2017 05:04 PM
You could use a radio button group in the place of two independent booleans. A radio button group has this logic built-in by definition. Or, if you don't want to use radio buttons, you can use an event structure that would detect a value change on the cluster.
04-05-2017 05:16 PM
A radio button is certainly the easy way to do that.
However, if you ever want to have more than one button selected or use more complicated logic, if you create a reference to a cluster and add a property node to it, one of the properties you can access is "Controls[]", which is an array of references to all controls in the cluster. You can then check the labels or other properties of those controls to find the ones you're interested in and enable/disable them.
04-05-2017 05:19 PM - edited 04-05-2017 05:21 PM
I'd rather not use radio buttons because they don't look very nice. So right now my cluster is fed into a cluster to array function, then into a boolean array to number function. I then use a case structure to determine which button was pressed. However I am not sure how to turn that around and make them disable each other, once inside the case structure. Does that make sense?
Kyle just saw your post. Do you have an example of doing that by chance?
04-05-2017 05:40 PM
I was actually able to figure this out using radio buttons and stacked sequence structure. Thanks!
04-05-2017 05:48 PM
Even though you figured it out I recommend you watch this YouTube video to learn how to disable and enable controls programatically for future reference.
04-05-2017 05:54 PM
You can connect property node to any element in the cluster / radio buttons the same way you do with separate element. Programmatic list of cluster element references is not necessary.
Have not seen your vi, but stacked sequence should be removed. Use wires to control execution order!
04-05-2017 07:33 PM
@MicahKurtz wrote:
I was actually able to figure this out using radio buttons and stacked sequence structure. Thanks!
The stacked sequence structure should have nothing to do with your solution. And is never really needed in LabVIEW at all. There is a reason NI buried it on the palettes in recent LV versions.
If you don't like the appearance of the radio buttons, you can customize the buttons to change the way they look.
04-06-2017 08:47 AM - edited 04-06-2017 08:50 AM
Try the attached control. It is a radio button group but looking at it, you would never know. No code necessary.