LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting - Get reference to Strict Type Def Control

Solved!
Go to solution

Hi - I have a need to automate some sorting and deleting functions in a strict type def of a enum control that I have. I would like to write a couple of programs to take care of that rather than go into the control type def and do it all manually.  The fact that a person can do those through the edit dialog tells me that you should be able to access those methods via scripting.

 

So, the basic question is; How do I get a reference to that control?

 

Thanks,

Dan

 

0 Kudos
Message 1 of 5
(2,844 Views)

The easiest way would be to open the typedef control using Open VI Reference, get a reference to the enum on the front panel, then modify the Strings[] property to set the value labels.

 

It appears this will not work in LV2012.  For some reason, the Strings[] property is returning a list of indices instead of the strings.  You can work around this by setting the value and using the Ring Text property to access the individual strings.  I have not tried this (busy!), but it should work.

0 Kudos
Message 2 of 5
(2,839 Views)
Solution
Accepted by topic author m3rl3n

A custom control is actually a VI, so use the Open VI Reference and give it the path to the typedef. Use the resulting VI reference to get the reference of the actual control on the FP and then call the Save Instruments method on the VI when you're done.


___________________
Try to take over the world!
Message 3 of 5
(2,837 Views)

Slap to Forehead - DUH moment

 

Since I'm using the enum as the main driver of the producer consumer state machine program that I'm working on, I don't have a front panel control to reference (just using constants on the BD), so I was trying to use the .ctl and get a reference to it through that.

 

I just need to create a FP object, get a reference to that and hide the FP control, then work the magic from there.

 

Thanks for the kick to the mind DFGray.

 

Dan

 

0 Kudos
Message 4 of 5
(2,832 Views)

Thanks.

 

I used TST's solution.

 

Dan

 

0 Kudos
Message 5 of 5
(2,828 Views)