LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

panel replication

I have a panel consisting of N controls.  Based on the application's configuration, I may need to replicate (ie, show) this panel N times during initialization.  Within in the block diagram, inside a for loop, Do I add this panel VI from the "Select a VI"  and connect a string path to it? 
0 Kudos
Message 1 of 7
(3,046 Views)
You would need to connect a string or path if that is what the subVI requires for an input. If you think you need a path to tell your main VI where the subVI is, no. When you insert a subVI into a main VI, the path to the subVI is automatically added to the main VI. You don't have to do anything extra.
0 Kudos
Message 2 of 7
(3,030 Views)
Do I need to set this panel VI execution to "reentrant"?
0 Kudos
Message 3 of 7
(3,020 Views)
If you want to open the panel several times concurrently you should change its extension to *.vit (template) and call it dynamically in your loop (using the functions in the Application Control palette - Open VI ref, the Run VI method...). This will create a new instance of the VI every time you run it, but just note that this is not necessarily good as a UI structure. What are you actually trying to do? What do you mean by "replicate"?

___________________
Try to take over the world!
0 Kudos
Message 4 of 7
(3,014 Views)
tst,

sorry about my confusion. Replicate may not be the correct usage, and I know I don't want recursion.  If my panel VI, for example, consists of  10 checkboxes with an  led associated with each, then I just want to call this panel VI "n times" in a for loop and display each panel in a main panel.  I'm just using this as an example in order to get a handle on how to properly group controls on a panel in order to access and update them.  I come from the OO world (ie., Java), so I'm thinking in terms of a panel as an object which consist of "N" controls.  So, in LabView, can I still think in terms of a Main Panel, having sub panels?  Should I also design these controls grouped as a cluster, therefore having one terminal input cluster, and one output cluster?

0 Kudos
Message 5 of 7
(2,994 Views)
What you do first is set the VI properties of the subVI. Go to Window Appearance>Customize and check "Show front panel when called" and Close afterwards if originally closed". This will make the front panel of the subVI visible when you call it in the main program. You subVI should have a while loop so that a user can actually set the controls and then exit when an "OK" button is clicked. Putting a large number of controls/indicators in a cluster is a good way to reduce the number of wires, so yes, I would suggest you do it that way.
0 Kudos
Message 6 of 7
(2,981 Views)

OK, the term "panel" may be the culprit. In LV, each VI has a front panel (FP) and a block diagram. The FP serves both as the user interface and as the interface for calling the VI as a function in another VI. When you say "panel" in a UI context, there will always be a VI with code involved.

Now, LV is not very good when it comes to dynamic UI elements because part of the basic structure of the language (and what makes it so easy to use) demands that you create your UI elements\data types in design time. There are ways to work around this, though, for those who are willing. For example, if I understand what you want correctly, you can create a 2D array of cluster and change the number of columns (as shown in the attachment). You can hide and show controls. You can open FPs of other VIs inside your FP by using subpanels. You can call VI templates or other VIs dynamically (as I said in the previous post). You can simply have several loops, each running a different VI. The most versatile way is using the picture control, but that is just a workaround for the basic drawback of not being able to create dynamic UIs.

Regarding subpanels and dynamically called VIs and your OO experience, there are several ways to do OOP in LV. Try searching for NI GOOP, DQ GOOP, OpenGOOP and so on to find more details.

___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(2,978 Views)