07-10-2024 06:08 AM
When I want a child class's VI to override the parent's VI, I right-click the child class and select "VI for Override". But you can also create a VI by selecting "VI from Dynamic Dispatch Template" and name it with the same name as the parent VI. This also accomplishes the override. Is there a difference between these two methods?
07-10-2024 06:42 AM
@ooth wrote:
Is there a difference between these two methods?
No. If a VI has terminals set to be dynamic dispatch and a child class has a VI with the same name, that VI is expected to be an override VI (and if the relevant settings, like the connector pane, don't match, the VI will be broken).
You can create such a VI from scratch or modify an existing VI. The two methods you described simply do some of the work for you.
07-10-2024 06:48 AM
OK good to know. Thanks for the quick reply.
07-10-2024 06:53 AM
@ooth wrote:
When I want a child class's VI to override the parent's VI, I right-click the child class and select "VI for Override". But you can also create a VI by selecting "VI from Dynamic Dispatch Template" and name it with the same name as the parent VI. This also accomplishes the override. Is there a difference between these two methods?
Using the "VI for Override" uses the parent's VI as the basic template instead of the default Dynamic Dispatch Template. Using the VI for Override will save you steps as the required controls and indicators will already be there for you and properly connected to the Connector Pane.
07-10-2024 07:15 AM
@crossrulz wrote:
Using the "VI for Override" uses the parent's VI as the basic template instead of the default Dynamic Dispatch Template.
Right, I was focused on the basics and forgot to talk about the actual differences between the two.
07-11-2024 03:34 AM
There are versions of LabVIEW where the "VI for Override" created a VI but didn't mark the .lvclass as changed.
The added VI was added to the class's cache though.
The result is everything looks dandy, even when reloading the project. Save all appears to save all, but doesn't save the .lvclass...
The problem showed only when you copy (or check out) the project (sometimes weeks later!). The cached class isn't there, the .lvclass is loaded from file, and that version doesn't have the override added to it. This (the override that's not in the class) goes unnoticed (e.g. no edit time error) and is a nasty thing to track.
If you explicitly save the class, everything's fine too.
You get weird conversations too (I fixed it, it's not fixed, it's fixed for me, it's not fixed for me, etc).
I think this was a problem in LV20, it got better but wasn't entirely fixed in LV23, maybe fixed in LV24 (didn't check), but I'm probably wrong and YMMV...