LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parent class data lost from child when dyncamically loaded

Solved!
Go to solution

Hello everyone.

 

I have a parent class "View" that has some private data, for example "Name" (string) and "VI refnum" (refnum).

A child of "View" is "Single Graph", that has a .vi "_Display.vi" that is a simple graph view, that I will later put into a SubPanel.

The class also has a .vi "Start UI.vi", that will simply start "_Display.vi". The idea is that I want the possibility to have multiple "Single Graph" instances.

 

From the attached screenshot you can see how I for test purposes write to the "Name" property, and also read it out (again, for test purposes).

In the "Start UI" vi this works fine, and both the Name and VI refnum is available.

I pass the object into "Start Async Call" and the graph window shows up.

 

The first thing I do with the "Single Graph" object is to read out Name and Vi Refnum, and as you can see from the screenshot, these comes out empty.

I can not understand how this is possible, but I'm certain there is a good reason for this behaviour.

 

I hope someone here could help me understand this.

 

Thanks in advance!

 

Regards,

Oksavik

0 Kudos
Message 1 of 12
(4,102 Views)

Oksavik,

 

sadly, a screenshot doesn't help much. Please attach the example code.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 12
(4,085 Views)

I tried to reproduce my problem in a simple example, but as expected this example worked just fine.

 

I've tried to isolate and strip away from the original code, and this seems to show my problem.

 

See attached code, (it's messy).

 

Open ViewTest.lvproj

 

Open and run "Single Graph.lvlib / Single Graph.lvclass / Start UI.vi"

 

Name is written to the object, which is passed to the "Start async".

 

"_Display.vi" is shown, but the value of Name is now empty.

 

Thank you so much for taking the time.

 

Regards,

Odne

0 Kudos
Message 3 of 12
(4,072 Views)

I'm sorry but your code doesn't work for me. I cannot load the PPL in LV 2015 but i assume that the PPL contains the parent class the SingleGraph is inherited from.

Which version of LV are you using?

 

Can you recompile the PPL for LV 2015 or provide the development project for it?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 12
(4,069 Views)

It appears that LabVIEW is unable to open a packed library buildt using an earlier version of LabVIEW (news to me).

 

I'm working in 2013, but I can compile to 2014 if that helps you.

I don't have 2015 installed unfortunately.

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

Installing 2015 now, and will upload a new version soon.

0 Kudos
Message 6 of 12
(4,062 Views)
It's not in the description but the title mentions dynamic loading of a child class. The thing to remember is that in LabVIEW,

Object=Wire

Therefore if you dynamically load two instances of the same child class (two different wires, or two elements in an array) they will both have a parent of the same class, but they will be two different instances of the same parent class.

If you want to have different parents share data (and so behave as though they were the same parent), you will have to provide a mechanism for doing that. On my blog is a couple papers that I presented at NIWeeks that discuss one DVR-based solution.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 12
(4,053 Views)
Oh yes, one more thing. You might want to reconsider using PPLs, based on the discussions I have seen online, they seem to be a lot more trouble than they are worth.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 12
(4,050 Views)

@mikeporter wrote:
[...] using PPLs [...] seem to be a lot more trouble than they are worth.

Mike...

Depending on the configuration, yes. But PPLs do have their place and can be very elegant for distribution of components.

However, breaking inheritance into different PPLs has its issues and should be avoided, correct.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 12
(4,040 Views)

That was not straight forward, but I've ported the project to 2015.

Attached is the same test project.

 

Hope this works.

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