LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Easier way to specify LabVIEW class inheritance with many classes in memory?

I have many hundreds of classes in memory, maybe a thousand or more.  It's extremely cumbersome to find the parent for inheritance in the drop down list.   Is there any easier way to find the parent in the list when creating or editing a class?

0 Kudos
Message 1 of 6
(1,742 Views)

Maybe there is. There is a tree that lists the classes in properties when you set the inheritance. You can also view the inheritance of classes in the project. Do you have a screen shot of what you are doing? 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 2 of 6
(1,712 Views)

Here's an image of the new class dialog and what I mean.  You see the size of that scrollbar in the parent class pane?  I can't even filter by name or anything, I have to scroll through this looking for the class of interest, and if it's layered a few layers inside of the heirarchy/lvlibs its tough to figure out where it's going to land in the list alphabetically.

0 Kudos
Message 3 of 6
(1,686 Views)

Ok I see what you are talking about and yes, that sucks. I do not know of another way to set inheritance besides dealing with that tree of LV objects. Maybe not exactly what you want but you can set the parent class programatically, see this post. 

 

https://forums.ni.com/t5/LabVIEW/Possibility-to-set-inheritance-of-LVOOP-class-programmatically/td-p...

 

I like to put prefixes in my class names so it reads like:  A_my_base_class.lvclass then when I inherit I make a B_child_class.lvclass that inherits from A_my_base_class.lvclass

I keep each base and inherited classes in a lvlib so when you view them in the project explorer it gives them some kind of order, also it makes it easier to view when assigning a parent class.

 

Jay14159265_0-1640723946954.png

 

 

 

 

 

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 4 of 6
(1,680 Views)

Thank you, that's a really useful forum post and it occurs to me that someone has already probably written some sort of a script/labview extension that I can use to make this easier.  

 

As to your A_  B_ way of doing it, doesn't that become a nightmare if you're refactoring your code and potentially changing the inheritance tree?

0 Kudos
Message 5 of 6
(1,668 Views)

As to your A_  B_ way of doing it, doesn't that become a nightmare if you're refactoring your code and potentially changing the inheritance tree?


Well it could be but I keep my inheritance tree very flat and do more composition so refactoring is usually not a problem. The A_ naming convention is just so I can quickly see the inheritance level of a VI in the project manager without having to look at the hierarchy. If I move a VI to a new parent, I update the prefix. I never ever go past C_ this is my current project. 

 

Jay14159265_0-1640733608778.png

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 6 of 6
(1,657 Views)