LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting references to all of a VI's controls into a named cluster in a drawing space efficient manner

How do I get references to all of a VI's controls into a named cluster in a drawing space efficient manner? I can do this by using VI Server Reference and selecting each of the controls, and then putting all of that into a bundle by name cluster, but this takes a lot of space on the block diagram. Is there a way to compress this?

 

By the way, my block diagram is regularly "cleaned up" so the solution must accomodate that.

 

I thought about passing the VI reference or VI Pane reference into a VI and doing it there, but I don't get easy access to the control references by name, I just get an un-named array of controls which is tough to match up with a bunch of VI server references in the bundle by name.

 

Any ideas?

0 Kudos
Message 1 of 11
(4,902 Views)

Hi DEppAtNGC,

can you explain  a bit more please? What do you need as the result? An array of references or a cluster? If you need a cluster, then i think you can use the static references of every control, because you don't need the flexibility.

If you need an array of references, then you can get it from the vi with a property node. You can go through this array and read all names to filter out the controls you need.

 

Hope it helps.

Mike

0 Kudos
Message 2 of 11
(4,894 Views)

I need a cluster of references that sub vi's can use to set the GUI items on the parent "application" VI. The cluster makes it easy to pick the reference for the indicator who's value the sub vi needs to update. I can already do this; what I'm trying to figure out how to do is get references for 30 controls/indicators to occupy something about the size of 1 VI in the main VI, otherwise, when I cleanup diagram, it's one more thing that expands the size of the main VI diagram. The question is all about diagram size and how to do something "compactly".

 

 

0 Kudos
Message 3 of 11
(4,890 Views)

The controls[] cluster property will give the reference to all the contols in a cluster as an array.. Will that help? Is your current indicators grouped into clusters?

0 Kudos
Message 4 of 11
(4,887 Views)

DEppAtNGC wrote:

I need a cluster of references that sub vi's can use to set the GUI items on the parent "application" VI. The cluster makes it easy to pick the reference for the indicator who's value the sub vi needs to update. I can already do this; what I'm trying to figure out how to do is get references for 30 controls/indicators to occupy something about the size of 1 VI in the main VI, otherwise, when I cleanup diagram, it's one more thing that expands the size of the main VI diagram. The question is all about diagram size and how to do something "compactly".


As I understand it, most of what you're trying to do is to cause a bunch of identical objects on the block diagram - references to individual front panel items - to take up less space.  Unfortunately you just can't do that; a front panel object takes up the space that it requires.  You might be able to wrap them all in a single-frame sequence structure and then shrink the sequence structure to the size you want, but it will obscure what you're doing.

 

As an alternative, consider ways to avoid the cluster of references.  If the only property you're using is the value property you can probably store your data in a cluster instead (maybe you're already doing that) and then create a single VI that updates the appropriate control when a value changes.

 

There is also a simple but risky approach: you could take your array of control references from VI server and typecast it directly into your cluster of references, but that assumes that you have a cluster element for every front panel item and that the order of front panel references exactly matches the cluster ordering.

0 Kudos
Message 5 of 11
(4,879 Views)

Hey everyone, you can access an array of references for every control and indicator by using a "pane" reference.  To get this reference, just put a blank reference down from the application control pallete, then select it to be pane.  Here is a screen shot of an example code that just displays the name and value of every control and indicator on the front panel.

 

Controls as Array.jpg

Hope that helps!

Chris Bakker
SET Americas
CEO

0 Kudos
Message 6 of 11
(4,851 Views)
Now you are up to speed with where I'm at... now get those references into a named cluster. We need something that can grab references from that control array by the name of the control.
0 Kudos
Message 7 of 11
(4,849 Views)
Move Label.Text string indicator outside the For loop so it is autoindexed and is actually an array of strings.  Search the array for the string you want.  Use the index found to index out the array of references.
0 Kudos
Message 8 of 11
(4,838 Views)

Here's an approach that I think does what you want, although it's not as straightforward as one would like.  Build your cluster of references with the reference names matching the corresponding control labels.

 

Now, in your subVI that sets up the reference cluster, do as shown in the attached image and subVI (saved in LV 8.5).  Convert the cluster of references into an array.  Create an array of all the cluster element names.  For each front panel control or indicator, search the cluster element name array and use the output as an index into the reference array.  Outside the for loop, convert the array back into the cluster.  This approach ignores any front panel items that do not have a corresponding entry in the cluster.

build cluster of references.PNG

Message 9 of 11
(4,802 Views)

That's pretty good... I'll use some derivative of this that does the searches from a hard-coded string. I don't want to FORCE a 1-to-1 name relationship between the control and the reference so that if for some reason the control name needs to be aesthetically changed without having to make corresponding changes to the reference names. Good stuff...

 

I still would like a diagram structure that is "iconizable" by using a "view as icon" so that there is a way to hide infrequently changed code that MUST reside within the same context as the enclosing VI.

0 Kudos
Message 10 of 11
(4,747 Views)