> Newbie here. I need to have a few of a subvi's controls on the front panel
> for my main vi. How do I do this without ending up with two controls (duplication)
> for each? I have tried creating a duplicate control on my main vi front panel
> and then wiring it to the subvi's terminals but then I have two possibly
> conflicting controls wired in series to an input.
> Up to now, I can only think of two ways around this problem but neither are
> desirable for me.
> 1. I could have the subvi pop up as a dialog or have the vi front panel open
> and then close after settings are made. There are some logistical problems
> with this idea.
> 2. I could modify the subvi by removing the controls and save/rename it.
> Then I could put the controls on the main vi only. The problem is that
> then I'd defeat the purpose of having the original subvi. The subvi I am
> using is from an instrument driver I got off the ni site.
> Any ideas? This must be a very common problem!
You don't really mention what you type of control it is. Most of the time,
you do end up placing the control on both the subVi and on the main panel.
The only thing that flows between the subVI and main VI is the data of the
control, and in your case, you are typically going to have only one of the
panels open at a time. In case of debugging, it is really handy to have the
control on the subVI in order to see intermediate results or interact
with it.
The cost of this other control can be really small, or it may take an extra
copy of the data. This is of course minimized when possible, but it does
happen sometimes. Also keep in mind that the input and output data to a
subVI is supposed to be controls and indicators. They are there not only
for you to interact with, but also to define the types for the data.
The only time you want to avoid this is when you end up duplicating lots
of code. At these times, try to put most of the code into another subVi.
The best way to get the hang of this is to look at examples and other
peoples code.
Greg McKaskle