LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Opening VI reference to vi which is in class

Solved!
Go to solution

Hi all,

I have some concerns. I call VI as shown below, but this VI is part of class.

arturs_0-1720780551667.png        arturs_1-1720780678582.png arturs_2-1720780711239.png

So normally I push class to it, but what shock me is that it still works even without specifying class and communication is proper as I can change some values in class.

My question is if it is just some luck that it works in this configuration or it is determined... As I would like to use it to other classes that I have in this program.

Best regards,

0 Kudos
Message 1 of 5
(396 Views)

Your question is a little unclear but I think I understand it.

 

Are you saying that you are calling a VI by reference but that it is a Dynamic Dispatch class member and want to account for the fact that it might have an override written for it by a descendant class?

 

The main problem here is that a Dynamic Dispatch VI is only usable by calling it and passing in a class as an input which then determines which instance to call.  Calling it with the "Run VI" method bypasses that since that method does not take values as inputs, it just runs the VI as if you had opened its front panel and pressed the "Run" button.

 

Is this a class you have complete control over and can rewrite as necessary, or is this a shared or password protected class that you have to leave alone?  If you can modify it then there's a somewhat roundabout method to do what you want.

Message 2 of 5
(335 Views)

Yes it is VI from Dynamic Dispatch class and I'm calling it by reference.

So just as I thought, it is a bit of luck that it works fine (in perspective that I wrote that without hesitation and just after 6 months started to think if it should work or not) even though I access camera session over it. And as I understand it worked because I had this class in memory and this calling found it, if I had two instances of this class or didn't open class before pop up it will end up with error?


I have full control over class so that is not a problem. In other application I call classes as separate popups/VI's (like I have few popups for each class). It's just that I had to lighten application a bit and created one popup/VI with tab control where I want subpanels of VI's from few classes.
So in summary I know how to call VI from class it's just that I want to call VI's from few classes as subpanels in one VI...

0 Kudos
Message 3 of 5
(309 Views)
Solution
Accepted by arturs

If you want a VI to work like a "proper" dynamic dispatch VI but still have the features you currently want to use, you will need to:

 

  • Add some code that causes the VI, after being called, to send a message back to the calling VI containing a reference to it
    • This reference will then be what you would insert in the sub-panel instead of the way you do it now
    • Modify the connection pane, class data to pass through a queue or notifier reference, or have some other global messaging service that can do this
  • Create a static dispatch "wrapper" VI at the top level of the class hierarchy that matches the connection pane of the dynamic dispatch VI, and load and call a reference to that instead
    • The static dispatch wrapper VI will do nothing other than passing all its inputs to the Dynamic VI.  It's sole purpose is to allow dynamic dispatching to work properly when called by reference.
  • Change your calling method
    • Instead of using the "Run VI" invoke node, you will need to do an asynchronous call by reference using a strictly typed VI reference to the static wrapper
    • This will call the static dispatch VI that calls the appropriate dynamic dispatch VI and then allow dataflow to proceed to where it waits for the VI reference from the message mentioned earlier
Message 4 of 5
(263 Views)

Thanks for answer I already use those solutions, but not together so I will try it. 

0 Kudos
Message 5 of 5
(225 Views)