LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Possibility to set inheritance of LVOOP class programmatically?

Solved!
Go to solution

I would like to program a class generator:

The user selects an existing LVOOP class and the generator produces a LabVIEW project containing a new class which is a child class of the previously selected class.

 

Is there any possibility to set the parent class of a LVOOP class programmatically?

 

Attached, there is a VI (main.vi) that creates a project and adds two classes (Parent.lvclass and Child.lvclass). How could I modify the VI such that it makes the class Child.lvclass to be a child class of Parent.lvclass?

 

Thanks very much in advance for any help!

Message 1 of 12
(4,970 Views)
Solution
Accepted by dlanger

You're using the ActiveX interface. Is there a reason for that? If you stop using the ActiveX interface and use LV directly, LV classes have a full suite of methods/properties available.

As long as you're using the ActiveX interface, I have no solution to offer you. Nothing about libraries (from which LV classes inherit) has ever been exported to the ActiveX interface.

 

Using VI Server types, your code translates as shown:

 

SetParent.png

Message 2 of 12
(4,941 Views)

SetParentClass is a private function in LabVIEW 2010 SP1 and earlier.  Here is a LV 2010 SP1 VI which wraps it.

Message 3 of 12
(4,924 Views)

 


@DFGray wrote:

SetParentClass is a private function in LabVIEW 2010 SP1 and earlier.  Here is a LV 2010 SP1 VI which wraps it.


DOH. Forgot about that... we made it public-scripting for LV 2011. It should've been that all along. Thanks, Damien, for posting the wrapper.

 

Message 4 of 12
(4,914 Views)

@Aristos Queue and DFGray: thanks a lot, that's really great!

0 Kudos
Message 5 of 12
(4,902 Views)

Hi,

 

I can't find the private property SetParentClass in LV 2009 SP1, is it called something else in this version or is it just missing?

 

I can see all other private properties, using the SuperSecretSpecialblablabla=TRUE in LabVIEW.ini.

 

Could you convert it down to LV 2009 for me or maybe point me in the reight direction?

 

Thanks

/lind

0 Kudos
Message 6 of 12
(4,814 Views)

VI server properties are grouped by more and more specific as you go from top to bottom.  This property is in the bottom set.  LabVIEW 2009 SP1 version attached.

Message 7 of 12
(4,807 Views)

Thanks for the conversion, but is the answer to my question that "SetParentClass" is actually more private than the private methods and properties that becomes available with the SuperSecretSpecialStuff = TRUE? It is unavailable in 2010 SP1 and earlier?

 

/lind

 

 

 

 

0 Kudos
Message 8 of 12
(4,786 Views)

To my knowledge, there are only three levels of VI server - Public, Scripting, and Private (yellow, blue, and brown backgrounds respectively).  You may also run into Deprecated, which has a red background, and signals you should change to the newer version of that property or method.

 

The property is available in 2009 SP1 (it is in the bottom tier of properties on the menu), although it is private, and shouldn't be.  Hence the VI post.

 

Note that you should be VERY careful using private features.  Most are private for a reason.

0 Kudos
Message 9 of 12
(4,778 Views)

@DFGray wrote:
Note that you should be VERY careful using private features.  Most are private for a reason.

DFGray is right, but in this case, the reason this one is private is "developer stupidity." We just checked the wrong flag on the property. It should have been scripting all along and no one called us on it until recently. We're going to correct that in LV 2012.

0 Kudos
Message 10 of 12
(4,771 Views)