I have an array of check-boxes that I want to live switch inputs in indicators. I have two arrays whose cell values feed the indicators. The checkboxes indicate which array is being routed.
My options are:
The second options seems so much more elegant than the first.
I'm thinking that the references are going to need to be more than strings. I can make strings into a cluster, and iterate over the cluster. I don't know if I can make a cluster of object references.
Solved! Go to Solution.
When dealing with control references it is common to create a cluster of control references (type def'd) that you can pass around more easily. A common thing in my applications is that I gray out the controls that are not applicable to the user at the moment. For this I have a SubVI which take which takes in the Reference Cluster and an Enum for what controls should be grayed out. Then you can unbundle the cluster elements that you need, build an array out of them, and feed those into a for loop. Here is an example of mine:
What is the problem collect ref into array?
In the case of all boolean controls like you have, that is fine. You'll have an array of boolean references.
If you had some boolean references, some numerics, some strings, and built an array of those references, the array will be an array of more generic references. So when you use properties on them, they will just say "control". You'll be able to work on properties that all those controls have in common (such as enable or visible), but you wanted to do something more specific like set the display format of a numeric, you'll have to know your ctrlref is for a numeric, then cast that reference to a more specific class of a numeric to get to the more specific class properties.
If you bundle references into a cluster, each element in that cluster will still be of the more specific type.
RavensFan, I know about generic and specific clases.
But EngrStudent asked about array of check-boxes, so I suppose that all element is boolean.
So what are those light-blue things? How do I find them?
Reference controls. For your application, you probably want constants. Right-click on your control and select Create Constant.
This is not helping. I think that I need pictures here.
Here is a toy problem.
Let's say this is my VI
And lets say that I want the user to be able to wrangle the checkboxes and observe changes on candidate outputs before hitting the "send button".
So I can do this (horrible gross thing) in the Block diagram.
So it is really in the mouse-clicking selection of links to front panel to get things wrong. It easier for me to double-check displayed text. It would be faster for me to make.
I want to make the above (small monster) into something that looks like this (obvious non-functional example), except that it works (and does not look like an obvious non-functional example).
I'm thinking this is looking pretty good. I just need to get the Block1 checkbox to not simultaneously act on block 1 and block 2.