04-27-2011 05:12 PM
Hey all,
I have an interesting situation that I can't figure out how to do. I want to take a control from a running VI and replicate it on a new VI (with the same colors, properties, etc). However using the TopLevelDiagram:Make Selection and Copy selection methods, you can only copy from a VI in edit mode. Does anyone have other ideas on how to accomplish replicating a control using VI Scripting?
Thanks for the help,
David
04-27-2011 05:24 PM
Why can't you get a refnum to the control you want to copy, read it's properties, create a new control, and set the properties?
04-27-2011 05:28 PM
I can get you close, but not the exact control...
The forum won't let me post images at the moment... I'm not sure why... so I posted the image of the diagram here:
04-28-2011 01:30 AM
Just use the VI's Create by Reference method. I added a snippet in AQ's thread.
04-28-2011 08:44 AM
Hey thanks everyone for the advice.
Steve: This would definitely work, just requires more work when I was pretty certain there was a much simpler method.
AQ: This copies the data type of the control only, I was looking to copy all of the properties, class type, colors etc.
tst: This seems to do exactly what I was looking for!
Attached is the VI example in case anyone stumbles across this later on...
04-28-2011 11:15 AM
*head smack* I forgot about that method. Good catch, tst.