LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reopen and display more than one instances of the same subvis?

I know this has been discussed a lot before. But my task is a little bit different from what has been mentioned. What I want is, click a button to open one front panel by calling one subvi with one parameter, and while the first one is open, click another button on the main vi to open another front panel for the same subvi but with different parameter. Is it possible? I attach my preliminary program, and hope you guys modifiy them to make what I want done. Thank you.
Download All
Message 1 of 4
(2,837 Views)
Check out this answer from a previous thread;

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=137&HOID=5065000000050000007BDD0000&HTHREAD=000056699&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0

Giving each instance different start paramters is just a matter of making a functional global that holds the startup parameters (e.g. as a flattened string) and allows the new VIs to search for the data that belongs to them...I make a copy of the VI, insert the data for that instance into a 2D string array; in the first column I put the name of the new instance, in the second column a flattened version of the inut parameters..the first thing the instances do when they are run is to call the functional global with their name as input and search as the chosen functio
n...the global finds the row contining the name and sends out the parameters...It can then either erase the entry for that VI immediately, or you can let the instance send a delete command when the instance terminates instead...if you want access to the startup parameters other places as well as long as the instances exist... Using a flattened representation is off course not necessary.

You can use VI server to set controls when you run the new instance, but that functionality is not supported in built applications...hence the use of a functional global instead...
0 Kudos
Message 2 of 4
(2,837 Views)
Do you suggest me to use global variables? I know little about it, so could you please give me an example about it?
0 Kudos
Message 3 of 4
(2,837 Views)
Not globals, a functional global is a special VI; read more about it on:

http://zone.ni.com/devzone/conceptd.nsf/webmain/82E60E34E609C22A862569F8007E3F4A?opendocument

But one thing is just to store data (read/write), in addition you can add more advanced functionality...

Attached is a VI I use to hand off tcp/ip references to instances of a session handler...The name and reference is written into the example VI when the instance is created, then the instance reads out the reference by calling it with it's name as input ("tag").

Replace the reference array in the example with an array of the parameter you want to transfer to your cloned VIs...the most versatile is to use a string array and then use flattened data.
0 Kudos
Message 4 of 4
(2,840 Views)