LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
BrianGShea@NGC

Class Override Template

Status: New

When creating VIs in a class that are meant to be overridden, it would be nice to have a template VI that will be used as the template. The easiest way I though of to accomplish this is to create an Override template that has the same name as the VI but with an extension like .OVIT (Override VI Template). 

 

An new item can be added to the context menu when right-clicking on the class to Create New Template for Override VI, which will give you basically the same format as a new vi from dynamic dispatch template, but will include the call parent VI followed by an error case structure.

 

This will allow an architect to create a template for coders to use and place any useful information on the Front Panel or Block Diagram. When the override vi script runs to create the new override VI from MyOverride.vi, it can search for MyOverride.ovit and if found replace the base class' type with the child class' type. Otherwise you get the default VI which has the call parent method.

 

I know this idea has been pass around before, but I thought I would respire it.

 

My goal is to allow architects to give more meaning full information to other developers and more complete starting points for overridden class VIs.

 

Issues that can arise

What if the VI is renamed? Then the maintainer of the class will need to also rename the template VI, but it would be nice if LabVIEW did this automatically.

What if the VI is removed from the project? The OVIT would also be removed.

What if the OVIT is broken, ie. won't execute? Like all class VIs, it should not be broken, the template should contain working code or disable parts that need to be implemented. It would be nicer if the OVITs were ignored for borken code and not allowed to be place on the block diagram for execution.

 

 

 

 

Brian G. Shea
Certified LabVIEW Architect
14 Comments
AristosQueue (NI)
NI Employee (retired)

fabric: Your idea to "override data" is called templates in C++, called generics in C#, and called a good idea generally. It's also its own idea already on the Exchange. 🙂

fabric
Active Participant

Ha! I should get out more... Smiley Happy

Active Participant

I want to say that I like the direction this is headed and strongly support its implementation.

 

In my situation, I'm charged with developing a base class for launching and managing modal and floating windows (dialogs, wizards, assistants, info panels, etc.). There's some code that just has to be run inside the window VI, but I want to provide the "80% use case" to end developers as a template. As it stands, I'm having to add a scripted wizard to the <vi.lib>\project folder and train people to use it because I they can't just right-click on the template VI and select "New from Template...". (That makes a new VI in the base class, or it makes a new VI with no class and a broken diagram until they move it to their new class.)

User002
Not applicable

Necropost, but I bumped into this today in just the scenario described. I'm looking for a way to inherit template UI framework from a parent UI class. I appreciate the color, grid, and connector pane continuity. What I really would like is when overriding to have the option to select from a new method with "Call Parent Method" on its diagram or from the template .ovit file that has a bunch of pre-populated diagrams (mostly for the code I use to exit the UI VI when removing it from the subpanel).

 

I have run into this in non-UI contexts, but it generally centers around code that would stop loops in the override VI. It might be that the context isn't UI VIs as much as having the override start with loops that have a prescribed shutdown mechanism.