LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create logic inside a cluster

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?

0 Kudos
Message 1 of 9
(4,475 Views)

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. 

aputman
Message 2 of 9
(4,470 Views)

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.

0 Kudos
Message 3 of 9
(4,452 Views)

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?

0 Kudos
Message 4 of 9
(4,450 Views)

I was actually able to figure this out using radio buttons and stacked sequence structure. Thanks!

0 Kudos
Message 5 of 9
(4,438 Views)

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.

0 Kudos
Message 6 of 9
(4,431 Views)

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!

cluster disable.png

0 Kudos
Message 7 of 9
(4,430 Views)

@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.

Message 8 of 9
(4,414 Views)

Try the attached control.  It is a radio button group but looking at it, you would never know.  No code necessary.

Capture.PNG

aputman
Message 9 of 9
(4,365 Views)