LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add new class to project programmaticly

Hey, I am getting the hang of this... thought it would be alot harder, but five minutes later I got it working. The trick is to set the access scope using a method from LVClassLibrary.

 

ClassAndPrivateVFolder 

 

This then creates the following..

 

ProjectWindow.png 

 

Again, thanks for all the help 

Message 11 of 18
(457 Views)

Hi WireJunky,

 

I think you have license to mark your reply as the solution (unless you want to mark corny's Smiley Wink )

 

Ben

0 Kudos
Message 12 of 18
(453 Views)

cool. Using the name of the object in memory to add it to the project! didnt know that was possible - learned something new Smiley Tongue

 

Perhaps even the LVClassLibrary(Name) prop. node can be avoided since you already know the name? (will try this, and ofcourse see what will happen with more items with the same name (if thats a identifier, it should give an error?)

 

0 Kudos
Message 13 of 18
(437 Views)
Highlighted

Hi corny,

 

I just put the class name property in there because I was lazy :smileyhappy:,

you need to add the item using its full name -for the newly created class this would be "Test.lvclass" 

 

 

0 Kudos
Message 14 of 18
(428 Views)

hehe, thanks. And to inform, it does give out an error:

 

Error 43 occurred at Invoke Node in Untitled 1

Possible reason(s):

LabVIEW:  Operation cancelled by user.

Method Name: LabVIEW Class:Create

 

with more than one classes with the same name. (dont ask me why its error 43 tho). Edit: The error only happends if one of the objects properties have been read, or written to, before creating a new one with the same name.

Message Edited by Corny on 02-10-2010 08:21 PM
0 Kudos
Message 15 of 18
(424 Views)

Trying to think if there exists a situation where you would want or would have two classes with the same name...

cant think of any,  but I could be wrong. Now I wonder if it isn't possible to create some override vi's programmaticly.

The first step would be setting the parent of the newly created class and then...  somehow create those override vis

0 Kudos
Message 16 of 18
(415 Views)
hehe, no there really is no point in doing that. but what the heck, just wanted to see if it happends (In case youll get a typ'o (or wire'o) its good to know). Love trying out stupid stuff 🙂
0 Kudos
Message 17 of 18
(405 Views)

Think Ive hit the end of the road with this endeavor, there are no methods or properties that set the parent of the created class.

There is a property to get the parent, but not to set it. Anyway, was worth a try.... :smileyvery-happy: - hope someone can prove me wrong. 

At least Ill be able now to create a empty class skeleton with some commonly used virtual folders to organize things nicely  

0 Kudos
Message 18 of 18
(393 Views)