08-31-2012 02:08 PM - edited 08-31-2012 02:08 PM
Hi All,
See the attached code. I'm using a callback VI and need to pass some references via user parameters. I use an array.
The question is, to avoid coercion (should I care?), I type cast to more a generic class, then in the callback function, go to a more specific class. (Is this the best way to do it?)
As you can see, though, for some reason almost all the property nodes are reading as variants, forcing me to use Variant To Data, which seems inefficient. Why is this the case? If I type cast to bool, Value should be a bool... why force me to use Variant To Data?
Is there a better way of doing all of this? Thanks for the feedback.
Solved! Go to Solution.
08-31-2012 02:12 PM
I would just use a cluster. All of the references can stay their own type that way (instead of converting back and forth).
08-31-2012 02:16 PM
if you use a cluster istead of an array you can maintain the strictness of the reference.
THe reason you are getting variants is you are not casting the ref back to the same type. Try...
In main create a constant from the strict ref wire. Drag that constant into the call back VI and use it when you cast as more specific. You property nodes should adapt to the specific data type they were in main.
Note:
You can also create refs of the proper type by dragging the appropriate type of control into the ref control and it will adapt.
I hope that made sense.
Ben