07-14-2011 03:50 AM
Hi all,
I'm new to LVOOP and wondering if it's possible to create a dynamic dispatch VI from the parent VI as a template.
For example:
I've got a Class-method in the parent class. All child-classes use this method except of one child, which needs a little tweak on this VI.
So I need to overload the VI in the child class.
When I choose "New -> New Dynamic Dispatch VI" I get an VI based on a template
(As described by Darren Nattinger here: http://forums.ni.com/t5/LabVIEW/Darren-s-Weekly-Nugget-07-07-2010/m-p/1172483/highlight/true#M510414 )
Is it possible to get a copy of the parent VI instead that I can tweak ?
Thanks you in advance!
Best regards,
Balze
07-14-2011 03:57 AM
Balze,
if you create a vi for dynamic dispatch in your parent class, you can select New>>VI for Override. This template calls the dynamic dispatch VI from the parent class. So if you simply want to add functionality (imho classic usage for overloading), this is the way to go.
hope this helps,
Norbert
07-14-2011 04:09 AM
Thanks Norbert,
I found this way to create dynamic dispatch VIs before.
But that only generates a wrapper around the parents VI.
As you mentioned: To add something before or afterwards the execution of the parent VI that's the way to go.
But that doesn't help me with my problem to tweak the parent VI.
Thanks anyway !!
Best regards,
Balze
07-14-2011 07:30 AM
There's no way to do it that I know, but I would love one, maybe put up a product suggestion?
07-14-2011 08:14 AM
I would just do a "Save As" on the parent, then move it to the child class and rename as the same as the parent.
Of course it also easy enough to just drag the parent code into the child and mod as required.
Ben
07-14-2011 08:19 AM
will doing a save-as create it as an override vi? I had problems with that before... (I thought)
07-14-2011 08:30 AM
Hello,
@ Briota: Let's see if even more users would like to have this feature and then put up a product suggestion.
@ Ben: I tried the "save as" method several times and again and again ran into problems.
Could you please explain your "way" more detailed that i can follow it exactly ?
The drag code int new created dynamic dispatch VI is the way I currently use.You're right, it's easy enough.
I just thougt I missed something because this way to create child methods seems so obvious for me.
Thanks.
Best regards
Balze
07-14-2011 08:34 AM
An over-ride VI is not that special.
The input and output classe must be "Dynamic".
The icon connectors have to be the same.
The Over-ride VI must have the same name as the parent and be a member of the child class.
So Save-as add to project but not to class.
Move to child class.
Rename.
Ben
07-14-2011 08:54 AM
@Ben wrote:
So Save-as add to project but not to class.
Move to child class.
Rename.
And then manually change In and Out Terminal to Child Class, right?
Thanks
Best regards,
Balze
07-14-2011 08:58 AM
Pointing out my mistakes always earns Kudoes!
Good catch.
Ben