LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you get the default value of a typedef from the path?

I know I can obtain a reference to a typedef by using the Open VI Reference primitive. However, if I get the Front Panel>>Controls[1]>>Value property, the variant I get is not a typedef. How do I get the default value variant from the .ctl path?

0 Kudos
Message 1 of 7
(3,355 Views)

I didn't know you could do this, so I thank you for pointing this out. What you described worked for me for an enum. Make sure your default value actually returns something. For my enum the variant looked blank at first because the first value in the enum was a blank string. Hope this code snippet helps:

 

control ref.png

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 2 of 7
(3,337 Views)

Be sure and pass error wires between those functions, and close the reference you opened when you are done or you will have memory leaks.

0 Kudos
Message 3 of 7
(3,325 Views)

Um, deleted already this demo, but thanks. Smiley Indifferent

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 4 of 7
(3,319 Views)

@garrett8357 wrote:

However, if I get the Front Panel>>Controls[1]>>Value property, the variant I get is not a typedef. How do I get the default value variant from the .ctl path?


The variant is the value of the control sitting inside the typedef. It is not a typedef itself. To get the value, you could do something similar to what I describe in this idea. Just get the value property instead.

0 Kudos
Message 5 of 7
(3,310 Views)

altenbach,

 

I know how to get the value of the control on the front panel, but I want to get a variant of the typedef from the .ctl path. Maybe it isn't possible.

0 Kudos
Message 6 of 7
(3,299 Views)

I don't have a development environment available right now, but you may be able to create a reference to the control with scripting.

There might be something in vi.lib\Utility\VariantDataType that can get a default value

Lastly, would a class suit your needs? Loading a class into memory from file is a well documented process

_____________________________
- Cheers, Ed
0 Kudos
Message 7 of 7
(3,279 Views)