LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re-casting of object from control reference

Solved!
Go to solution
Solution
Accepted by topic author crcarlin

aHA!

 

nathand, you gave me the key to solving this. I wish I could post a screenshot of the solution, but the development computer is not networked.

 

For future readers, nathand showed that LabVIEW can indeed put a casted object back into its control. To put it another way, a control of type child can accept the wire of type parent.

 

So, for a cluster of objects, one can pick off each object and perform the operation shown in nathand's picture. Which is nice.

 

In my case, though, the objects are burried one step deeper. I have a cluster of clusters of object+configuration. Turns out LabVIEW can't handle putting a cluster of parent+config back to the sub-control of child+config. (It CAN, however, put child+config back into sub-control of child+config). I guess implicit casting isn't triggered when the object is not operated on directly.

 

The solution was to unpack all the way down to the object in its cluster and operate directly on it. The wiring went as follows:
OuterCluster.Controls[] -> index to get control ref -> ref to more specific class of cluster -> Controls[] -> index to get object ref -> Value -> Variant to Data

 

This gives the object. Then after running the class method, wire the object right back to the object ref.

 

(and all this could have been avoided had LabVIEW a better way to specify those black bordered class constants with non-default initial values)

0 Kudos
Message 11 of 11
(1,097 Views)