LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Iterating in an event structure over subset of control items

Solved!
Go to solution

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:

  1. make a giant list of property nodes with switches (30+ of switch, subset, update property)
  2. make a loop that iterates against a ring (or cluster) where the iteratable enumerates the objects to look at ring+loop+1switch-subset-update

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.

 

Questions:

  • how do I make a list of references to inidcators that a for loop is willing to iterate over and switch values?
  • Is there any value (for the rest of the system) for me to put a timed delay in the while-loop + event structure?  Will it free up CPU for other things if there are timed delays in event checking?
0 Kudos
Message 1 of 23
(3,540 Views)

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:

 

Control Refs.PNG

0 Kudos
Message 2 of 23
(3,511 Views)

What is the problem collect ref into array?

array.png

0 Kudos
Message 3 of 23
(3,504 Views)
Solution
Accepted by EngrStudent

@Artem.SPb wrote:

What is the problem collect ref into array?

array.png


 

 

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.

0 Kudos
Message 4 of 23
(3,492 Views)

RavensFan, I know about generic and specific clases.
But EngrStudent asked about array of check-boxes, so I suppose that all element is boolean.

0 Kudos
Message 5 of 23
(3,477 Views)

So what are those light-blue things?  How do I find them?

0 Kudos
Message 6 of 23
(3,423 Views)

@EngrStudent wrote:

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 23
(3,418 Views)
Solution
Accepted by EngrStudent

see context menu

ref.png

0 Kudos
Message 8 of 23
(3,405 Views)

This is not helping.  I think that I need pictures here.

 

Here is a toy problem.

 

Let's say this is my VI

Capture.PNG

 

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.

Toyd.png

 

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

 

Toy2(fake)d.png

 

 

0 Kudos
Message 9 of 23
(3,387 Views)

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.

 

Toy2(fake)d.png

0 Kudos
Message 10 of 23
(3,375 Views)