04-11-2014 02:08 PM
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?
 littlesphaeroid
		
			littlesphaeroid
		
		
		
		
		
		
		
		
	
			04-11-2014 03:19 PM - edited 04-11-2014 03:19 PM
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:
 Hooovahh
		
			Hooovahh
		
		
		 
		
		
		
		
		
	
			04-11-2014 03:29 PM - edited 04-11-2014 03:29 PM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
 littlesphaeroid
		
			littlesphaeroid
		
		
		
		
		
		
		
		
	
			04-11-2014 03:45 PM
Um, deleted already this demo, but thanks. 
 altenbach
		
			altenbach
		
		
		 
		
		
		
		
		
	
			04-11-2014 04:02 PM
@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.
04-11-2014 04:30 PM
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.
 yenknip
		
			yenknip
		
		
		
		
		
		
		
		
	
			04-11-2014 05:10 PM
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