LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of SubPanels

Hello,

 

Is is possible to have an array of clusters with a SubPanel inside each cluster and load one different SubVI into each SubPanel? I was not able to create just a array of SubPanels. I had to insert the SubPanel in a Cluster and then insert the Cluster in the array.

 

I wrote a code that is almost doing what I want, but as soon as the array element in index 1 gets its SubVI, the array element in index 0 does not show the previous loaded SubVI.

 

Find attached the main VI and Vis to be used as examples.

 

Thanks.

 

Dan07.

 

Code.jpg

Download All
0 Kudos
Message 1 of 6
(4,757 Views)

I don't think that's going to work. You can't set the property of an individual element of an array; that violates the basis of an array. It's the same reason you couldn't have an array of controls and set ones background color to red while the other is green.

 

--Ryan S.

0 Kudos
Message 2 of 6
(4,739 Views)

There is one way to build an array of vi references to different vi's.  They must be strictly typed  That means they must have the same con pane pattern and the same data types in the wired terminals.

1!.PNG

This array builds beautifly

 

 

Now when building your "Plug-ins" passing data in as varient and out as flattened string & Type is an easy way to mix some data types on the boundry.


"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 6
(4,730 Views)

The property "ArrayElem" refers to all elements in the array.
You can easily check this with your code: You must have a control in the cluster (as you cannot create a cluster with just a subpanel in it). If it is a e.g. Boolean Button, write a different string in each loop iteration to the BoolText.Text property. When the loop finishes, all button texts will have the value you wrote in the last iteration.

0 Kudos
Message 4 of 6
(4,719 Views)

Will not work with an array: array is a collection of values and VI in the panel is a property of an element - sub panel. Properties are the same for all elements of the array.

Your VI first shows yellow FP in all elements of the array, even not active and then, on the next iteration - blue FP. 

Also IndexValues property sets the index of the top element of the array, not the index of element to get or control.

 

I do not see the way to have a variable and controllable number of sub panels (in one VI). 

 

I do not now the task, but may be it will be good idea to have a small number of panels and cycle VIs in them manually.

May be it will work for your task to make a cluster and to show/hide subpanels. You can change the VIs in these subpanels, arrange references to subpanels in array, but their number is fixed.

May be it will help to open a number of reentrant VI-shell  (just a subpanel) instances. You can arrange these as you want, control their number. And load your VI-s into these sub-panel instances.

0 Kudos
Message 5 of 6
(4,707 Views)

@dan07 wrote:

 

Is is possible to have an array of clusters with a SubPanel inside each cluster and load one different SubVI into each SubPanel?


You'll be happy to hear that the answer is sort of yes. As you've seen, you can't use an actual array for this, but you can simulate one cleanly and this example will show you how - http://forums.ni.com/t5/LabVIEW/User-interface-problem-list-of-clusters/m-p/2311770#M726599

 

Note that the example allows up to N subpanels (however many you replicate at edit time). For an unlimited number, you would need to modify the example to do something similar to what Alexander suggested.


___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(4,680 Views)