02-03-2011 05:48 AM
I wish to use LabVIEW scripting to create a strictly-typed refnum control that is bound to my custom control (a type-defined cluster), but I'm unfamiliar with scripting and can't see how to do it.
If I create a New VI Object, using Control Refnum as the Style, how do I provide my custom control to the VI Object Class terminal? When I try using a reference to my custom control.ctl file (using Open VI reference) I get an error: "Error 1057 occurred... Type mismatch: Object cannot be cast to the specified type."
Or, if I create a new Control Refnum as above, using a standard Cluster as the VI Object Class, how do I then convert this refnum control to a strictly typed refnum that is bound to my custom cluster control type?
Thanks in advance for any advice,
Solved! Go to Solution.
02-03-2011 06:23 AM
02-03-2011 07:09 AM
Hi Helmut,
Unfortunately, this isn't what I need. I need a strictly typed refnum control object, not a strictly typed control vi. In your example you created a boolean control object in a custom control vi. If you can instead create a Control Refnum object in a custom control vi which is bound to a custom cluster definition then that will help me. I can create one by hand easily, see illustration below, but I can't create one via scripting.
02-03-2011 08:27 AM
Full Disclosure: I have not tried this. However, you can usually figure out how to do a scripting operation by doing it manually, then doing it the same way with scripting. I would try the following:
Yes, I know it is convoluted. There may be a much faster way, but I still need to finish my first cup of coffee...
02-03-2011 08:54 AM - edited 02-03-2011 08:56 AM
02-03-2011 09:37 AM
I tried it, and, as usual, things were slightly different. The big issue is that a control reference constant becomes a Node, not a Constant, so cannot be converted to a control. The good news is that you simply move it to the front panel of the new control, just like you would in the dev environment. Here's the raw code (still needs cleanup to close refs and add save of the new control, plus, you don't need to show the control FP if you don't want to).
02-03-2011 10:02 AM