LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find dynamic VI's caller

I have a subVI that I place in a subpanel on different main VIs using dynamic calls.  I want the dynamic VI to respond to keypresses on the main VI, which I currently do through a registered event that has a static VI reference to the main VI, which means that it only works for one main VI at a time.  I would like to get a reference to the actual VI that called this dynamic subVI to eliminate the static VI reference, but I have had no luck finding a way that gets that reference.  Anybody know what I have missed?
Bart
0 Kudos
Message 1 of 3
(2,472 Views)
If the dynamic VI is simply being run using the RunVI method, it can't find out what is calling it because techincally nothing is calling it. If you check its state you will find that it's running as a top level VI.  Hence, the dynamic VI can't find out on its own who is calling it so the "caller" has to tell it. One way to do this is to create a VI reference on the dynamic VI's front panel called CallerVIRef - or something similar. Then in the calling VI after you open a reference to the dynamic VI and before you run it use the Set Control Value method to pass the caller's VI reference to the CallerVIRef control on the dynamic VI. Now run the dynamic VI and it will have the reference it needs.

Mike...

PS: If you are running the dynamic VI using the Call by Reference node the VI is being linked to the caller and the call chain will work as it always does.

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 3
(2,468 Views)
Hi Mike:
I was thinking that there must be something like you explained going on (I do use the Open VI method).  I just didn't stumble across the method for sending the value to a reference control.  That will  (of course) be a hidden control on the panel of the subVI.  That sounds like it will work when I try it tomorrow.
Bart

0 Kudos
Message 3 of 3
(2,458 Views)