09-26-2023 02:53 PM
When I create a class that is a subclass of another, there is no indication within the Project Explorer of the Parent Class, nor the inherited methods that class can use. At least, I can't find a way to show that and I don't think it is possible given this post on the Idea Exchange: Show inherited VIs as ghosts (new window.)
What I've found so far is to right click the subclass, and select "Go To Parent Class". That highlights the immediate parent and so methods can be seen; rinse-and-repeat until the top of the hierarchy is seen. There's also right click and select "Show Class Hierarchy" which will reveal the whole hierarchy but can't be modified to show things like methods.
So I'm interested: when working with OOP in LabVIEW, how do you handle this? What's the simplest way of identifying inherited methods whether from a Parent class or an Interface?
09-26-2023 03:20 PM
@andrewDJ wrote:
So I'm interested: when working with OOP in LabVIEW, how do you handle this? What's the simplest way of identifying inherited methods whether from a Parent class or an Interface?
You need to identify where they came from, or just identify them so they can be selected and placed on the block diagram?
If just for placing on the block diagram, then I go about this in two ways:
09-26-2023 03:39 PM
It's a good question and having been asked I'm not sure what the answer is. Classes are organised alphabetically rather than hierarchically so it's not immediately obvious. It's probably more useful where I am consuming some class library rather than one I've created myself.
I hadn't quite gotten to the implicit palette so that's a good tip - of course, it helps if the class has been saved and not just its methods which fooled me for a while.
09-26-2023 03:41 PM
@JimB. wrote:
If I want to browse methods, I right-click on the object and use the implicitly created palette. It will show all methods for that object or wire type, included inherited ones.
I was going to suggest the same thing but this feature is somewhat recent. I believe it came out between 2019 and 2021 as it's not there on my 2018 install. I can't find any release notes where it's mentioned.
09-26-2023 03:48 PM
@Kyle97330 wrote:
@JimB. wrote:
If I want to browse methods, I right-click on the object and use the implicitly created palette. It will show all methods for that object or wire type, included inherited ones.I was going to suggest the same thing but this feature is somewhat recent. I believe it came out between 2019 and 2021 as it's not there on my 2018 install. I can't find any release notes where it's mentioned.
Hm... I thought it was older than that, but I guess I'm misremembering. The oldest version I currently have installed is 2019, and I can confirm it is present in that version.
09-26-2023 04:09 PM
@andrewDJ wrote:
It's a good question and having been asked I'm not sure what the answer is. Classes are organised alphabetically rather than hierarchically so it's not immediately obvious. It's probably more useful where I am consuming some class library rather than one I've created myself.
Does the class hierarchy window help? (LabVIEW Class Hierarchy on the View menu.)
It doesn't show methods, so it may not be exactly what you are looking for, but it does show the object inheritance tree.
@andrewDJ wrote:
I hadn't quite gotten to the implicit palette so that's a good tip - of course, it helps if the class has been saved and not just its methods which fooled me for a while.
Yes, that's one important to know quirk if you are actively developing the classes as you use them. The implicit palettes are based on the saved contents of the .lvclass files, not the current state of the Project Manager, so you need to save the class itself for anything new you add to show up.
09-26-2023 04:18 PM
Yes, that window helps in identifying the class hierarchy and can be kept open. Coupled with the Go To Parent Class is one way to determine the inherited VIs. That's not particularly onerous I just wondered if there was a better way of traversing the hierarchy: I can imagine that once the number of classes grows to some large number then it becomes a bit more difficult.
I remember with LabVIEW NXG that it was SUPER important to continually "Save All" in case of a crash: I need to get that into muscle memory again until I at least get more used to how LabVIEW worked. Incidentally, in NXG one could open a class and it would list owned and inherited methods on that view which was useful.
10-02-2023 03:35 AM
@JimB. wrote:
- Assuming I remember the name of the method I'm looking for, I use Quick Drop.
- If I want to browse methods, I right-click on the object and use the implicitly created palette. It will show all methods for that object or wire type, included inherited ones.
Hmm, #2 doesn't work for me, but i can r-click and Explore. That works pretty well.
10-02-2023 03:46 AM
I’ve found number 2 to be hit-and-miss and often have to drag methods of the project explorer. I haven’t worked out yet what causes a method to appear on the implicit palette or not.