02-13-2010 10:25 AM
Im having a VI with controls, let's say some boolean control. From another running VI I want to be able to adjust the value of that control. How do I do that? I remember something about creating a reference of the control and calling
the reference in another VI. If I'm wrong, can somebody clearly explain what they are for?
Second, is there a way to call a subVi and display the front pabel in a tab of the VI from which i am calling it?
Thanks!
Solved! Go to Solution.
02-13-2010 10:45 AM - edited 02-13-2010 10:46 AM
1. In your front panel go to the Modern -> Refnum -> Control Refnum and place it on your panel. Then create a control of which refnum you need (in this case a boolean) and drag 'n' drop it into the refnum element on the front panel. Now you will have a refnum to your boolean control in your block diagram.
2. Place the SubPanel (Modern -> Containers -> SubPanel) element on your front panel and wire a reference to your VI you want to display to it.
02-13-2010 10:59 AM
On the Block Diagram select the terminal you want to update Right-Click>Create>Referance.
Here is a basic example of implementation (Attached)
So it is pretty easy to update controls with VI server referances. This technique is used often to handle GUI updates like status and messages to the user in medium and large applications.
Your other question
_Faust wrote:Second, is there a way to call a subVi and display the front pabel in a tab of the VI from which i am calling it?
Thanks!
Yes this is possible by using a Subpanel on your VI front panel. You can show your vi front panel in the sub panel. Read the help on sub panels because it does have a few caveats so you really need to know what limitaions you will run into
02-13-2010 10:59 AM - edited 02-13-2010 11:01 AM
1. In your front panel of the local VI go to the Modern -> Refnum -> Control Refnum and place it on your panel. Then create a control of which refnum you need (in this case a boolean) and drag 'n' drop it into the refnum element on the front panel. Now you will have a refnum to your boolean control in your block diagram. You can adjust the value of that control in another (foreign) VI simply by placing a Property Node of your control (in the foreign VI) and wiring the already created reference to it. So basically you need to transmit the reference from the local VI to the foreign one. The adjusted value can also be transmited or, if it is static, it can be placed on the foreign VI.
Sorry, I could not to edit my previous post. Just thought I could elaborate on the first point a bit more.
Please ask is something is not clear enough.
Jeff Bohrer wrote:On the Block Diagram select the terminal you want to update Right-Click>Create>Referance.
Just don't understand how I have managed to forget this one, including the fact that I use this method in most of the cases 😄
02-14-2010 04:58 AM
You might want to review Ben's nugget.
But keep in mind that using the 'value' property is by far slower than the terminal or a local variable. You won't rtealize it for a few booleans, but don't use it for larger data sets.
My own approach would be using user events. The top-level vi already has an event structure in place. The complete idea is presented in my own nugget.
Felix
05-16-2011 11:17 AM
I have been struggling with getting the Control reference wired to my property node. I finally got it to work but it just seems like i'm doing something wrong. What I did to get it to work is, on the block diagram of my main VI I created a property node for a numeric indicator. I then drug the property node from the block diagram of the main VI to the block diagram of the sub-VI. I then deleted the property node on the main VI. I was then able to wire the dignum refnum to the property node now labeled DigNum (strict). Am I doing this correctly? It seems strange I had to delete the property node on the main block diagram after I moved it to the sub VI.
Thank you