LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a subVi who outpouts its VIRef to connect to a supanel in mainVI

Solved!
Go to solution

Hi all,

 

I've got a VI who got some inputs and output, and id' like to output also it's VIRef so i can connect it to a subpanel and diplay it when a button is pressed.

Can someone help me?

Example code in the image

0 Kudos
Message 1 of 6
(946 Views)

Pallette >> Application Control >> VI Server Ref

 

Drop that on your block diagram.  From the drop down menu on that object, select "This VI".  Output that reference from your subVI and use it for the input to the insert invoke node.

0 Kudos
Message 2 of 6
(935 Views)
Solution
Accepted by topic author Ub4thaan

I prefer to connect sub-VI Front Panels to the sub-Panel "in the forward direction", that is, get the Main (with the sub-Panel) "find" the sub-VI it is going to display, rather than have the sub-VI try to pass a reference to itself backwards to the caller.  I do this by using a Static VI Reference (on the Application Control palette), right-clicking it, and Browsing for the sub-VI.  If you have created an icon for the sub-VI, you'll get a nice "self-documenting" indication of what you are doing, like this:

Sub-Panel Demo.png

This code is in the Main routine -- when it is executed, it will run the sub-VI right after placing the sub-VI's Front Panel in the Sub Panel.  

 

Bob Schor

Message 3 of 6
(912 Views)

I opted for Bob_Shor's solution, for now, becouse it's a bit more straight forward for a noob like me

0 Kudos
Message 4 of 6
(876 Views)

@Ub4thaan wrote:

I opted for Bob_Shor's solution, for now, becouse it's a bit more straight forward for a noob like me


Who is this Bob_Shor person?  Not only is my method straight-forward, but if you ever need to build an executable with this code, it will "automagically work".  I use a similar technique (using Static VI References) with working with "clones", routines started with "Start Asynchronous Call".

 

Bob Schor

0 Kudos
Message 5 of 6
(866 Views)

Sorry for misspelling you name, isn't done on purpose

0 Kudos
Message 6 of 6
(863 Views)