From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I programmatically access property of a control in a global?

I have an enumerated variable stored in a global. I would like to programmatically access property of this enumerated variable (say, "strings"). How can I do this?

Thakns a lot for your help,

Michael
0 Kudos
Message 1 of 5
(2,697 Views)
First you open a VI ref to the Global VI. Then you read the Panel property. The Panel refnum has a Control[] property which is an array of control refnums to all the Global VI controls. Enter this array in a for loop where you read the "Label" control property to look for the control labelled "strings" and use properties on this refnum. Do not forget to close ALL refnums after usage, that is those read in Controls[] and Panel.


LabVIEW, C'est LabVIEW

Message 2 of 5
(2,697 Views)
Everything works up to retrieving a refnum of the enumerated control in a global. The "Label.Text" property of the control refnums you mentioned contains names of the controls on the panel. However, the properties of these refnums when you invoke them, contain only universal properties and do not contain property "strings" specific to enumerated type I am after.

Unfortunately, this suggestion does not work.

Below, I attach the attempt to implement it illustrating the problems.
Download All
0 Kudos
Message 3 of 5
(2,697 Views)
Use the function "To More Specific Class" to cast the generic refnum to an enum type refnum. On the "target class" input, wire a refnum to the class you expect. You can use the "class specifier constant" set to enum type.


LabVIEW, C'est LabVIEW

Message 4 of 5
(2,697 Views)
It worked well - thank you very much, Jean-Pierre!
0 Kudos
Message 5 of 5
(2,697 Views)