LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Populate ENUM RING via Property Node String[]

Can you populate an ENUM Control using it's Property Node String[] Element? If not, is there a way to do this programmatically? So far I have failed to do this.
I am Using LV6.1.
Thanks
0 Kudos
Message 1 of 8
(5,979 Views)
The Strings[] of an enum define its data type. Therefore this is an EDITING change. This requires that the VI containing the enum is not running. So, yes, you can set the Strings[] property of an enum, but not from the diagram of the VI that contains it. You need to set it from another VI, so that the containing VI is not running.

Good luck,

-Jim
Message 2 of 8
(5,979 Views)
How exactly do you do this? Do you know?

Thanks
0 Kudos
Message 3 of 8
(5,979 Views)
You need to open a VI Reference to the VI that contains the Enum, then get a Panel reference, then read the Panel.Controls[] property which is an array of Control References. Then, search through them in a loop, until you find the Enum control, based on its Label.Text property (which corresponds to its Control Name). You now have a reference to the Enum and can set its Strings[] property. In order to do this, you will need an understanding of Refnum type casting and LabVIEW's class hierarchy. When I have a moment, I will create you an example, unless someone beats me to it 😉

-Jim
0 Kudos
Message 4 of 8
(5,977 Views)
Mr. Kring can probably come up with a much better example, but here's a quick one-off example in LV 6.0.2.

Download both attached files. Open enum_target.vi, and note that the enum shows only a single choice, "Before". Open Change_enum.vi, and point the file control to the enum_target.vi. Run the Change_enum.vi. The contents of the Enum control in enum_target.vi should have changed to the string array in Change_enum.vi.

This is a simplistic example, but it should work. Explanations are given on the diagram of Change_enum.vi of how references are pushed around in it.
Download All
Message 5 of 8
(5,979 Views)
Only saw this one once I posted my example...guess I'll have to code faster next time! 🙂
0 Kudos
Message 6 of 8
(5,979 Views)
Either way, as I predicted it might happen, you beat me too it. You must have been reading my mind 😉

Cheers,

-Jim
0 Kudos
Message 7 of 8
(5,979 Views)
Thank you Jim and Underflow. You have been a great help. I looked in the LV documentation about this control but wasn't able to find the info you provided. Again,
Thanks a bunch.

Atwork
0 Kudos
Message 8 of 8
(5,979 Views)