LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to upclass from a control withing cluster to cluster's label by control's reference

I have a cluster of various controls, I am passing the control references and trying to use to more generic class -> property label.text.  However when I wire a cluster generic constant it returns a broken wire.  Is there an easy way of doing this, getting the cluster label based on one of it's control's references?

0 Kudos
Message 1 of 10
(2,954 Views)

that's what I am essentially trying to do

0 Kudos
Message 2 of 10
(2,952 Views)
I've never tried this, but starting with a reference to a control in the cluster, you might be able to use the owner property to get a reference to the cluster containing it.

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 3 of 10
(2,928 Views)

Can you explain your larger goal? There might be an alternate approach that doesn't involve a reference.

0 Kudos
Message 4 of 10
(2,918 Views)

This is not what To More Generic Class does at all. Read its help and the error description and you might understand why it's broken and why it won't help you even if it wasn't.

 

As Mike suggested, the Owner property should return the reference of the immediate container.

 

Also, I would also say that if you're using something you're not understanding, it's quite possible that there are much better ways to do what you actually want to do, so you might want to explain that before moving forward.


___________________
Try to take over the world!
0 Kudos
Message 5 of 10
(2,892 Views)

gee, I feel scolded like a high-school kid, so many assumptions...

 

I am passing a reference to the control to the slave loop, where I want to get the owner's (cluster) label in order to see which category the control belongs, when storing to ini file.  Cluster being the parent of the control should work in theory, in fact I may have gotten it to work in lv2013 (now using 2014).

 

I have tried the owner property, owner property didn't work for me, if someone can show how to accomplish that graphically I would hightly appreciate it.

0 Kudos
Message 6 of 10
(2,879 Views)

You probably should feel somewhat scolded, but I'm not sure which assumptions you're talking about. I would still stand by the content of my previous reply, even if the presentation could be made more PC.

 

You still haven't said why it doesn't work, but I'm guessing it's because you haven't done the casting I did in the following image? Note that this is a cast down, not up, which is why it doesn't break the wire.

 

Example_VI.png

 

As for alternatives, there are already tools for saving clusters to files (the OpenG variant config VIs and MGI R/W anything VIs, to name a couple of examples). You might be better off using those.


___________________
Try to take over the world!
Message 7 of 10
(2,874 Views)

Thanks...I tried different combinations with the owner property, and it's clearly a cast down, since you casting down from the owner class to the cluster class.  In my case I was trying to cast up from control to it's cluster, which didn't work.  I appreciate your help.

0 Kudos
Message 8 of 10
(2,869 Views)
Here's another hint: use the correct terminology. In LabVIEW you can cast to either a more generic class, or to a more specific class. There might be similarities with other languages, but there are a lot more differences.

In LabVIEW a cluster isn't a parent of the items in it, its a container that owns those items. If other languages allow you to blur that distinction, that's their problem. LabVIEW does not.

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 9 of 10
(2,861 Views)

Just so it's clear - there is no Owner class. The owner has nothing at all to do with the class hierarchy, but rather of the positioning of elements on the FP/BD. The owner is a property of one of the classes (GObject, I think, but I can't check), which simply returns a reference to the object that contains that object (for instance, if you have a control inside a cluster).

 

The class of that reference is Generic, as can be seen in the header of the property node. I could have also cast it down to the Control class, which is where the Label property actually is, but that's only because I happen to know that the owner in this case is a Control (and a Cluster).


___________________
Try to take over the world!
0 Kudos
Message 10 of 10
(2,858 Views)