LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically set the default of a control

Hi, I am working on an application where in one part of the program the user can apply a waveform, then in a different subvi is this waveform is applied/not applied the default value of a certain control will be either digital trigger or no trigger. 

 

In short I want to know how I can set the default of a control based on the t/f of a boolean control.  I have attached a vi where I set the value, but in this vi, the value is permanent, I want to set the default but still allow the user to change the value if so desired.  Any help would be greatly appreciated. 

 

 

Message 1 of 6
(5,831 Views)

Hi MLH,

 

what is wrong in your approach of using a case structure?

 

IF switch is true

THEN Take User Setting

ELSE Use predefined default value

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(5,822 Views)

The way I had it for true, the value would be set to digital, and then on the actual control its not allowing me to switch from digital to none.  and vice versa for the false case.  I think I will just make it such that the false case will set the value to none, and the true case will just operate as it is now.  Thanks for your reply

0 Kudos
Message 3 of 6
(5,816 Views)

Hi MLH,

 

"and then on the actual control its not allowing me to switch from digital to none."

Why not? It's a control so you're able to change it's setting - as long as you give the user some time for that operation. When you instantly process using the output of the case structure it's just bad programming - and your fault...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(5,812 Views)

In short I want to know how I can set the default of a control based on the t/f of a boolean control.  I have attached a vi where I set the value, but in this vi, the value is permanent, I want to set the default but still allow the user to change the value if so desired.  Any help would be greatly appreciated.

 

DEFAULT values cannot be set at run time period- the default value is contained in the compiled code so changing a default value forces a re-compile obviously something that the Run Time Engine can't handle.  It is possible to load values from a file and apply those values to the control.  You can even make a decision at run time what value to load based on your boolean.

 

Look through the help for the configuration file operation palatte you'll get some ideas.

 


"Should be" isn't "Is" -Jay
Message 5 of 6
(5,811 Views)

Hello MLH,

 

If you right click a control on the front panel and select Data Operations you are given the option to "Make Current Value Default."  This sets the current value of the control to the default whenever that VI is launched.  Hope this helps.

 

Cheers,

 

David A.

0 Kudos
Message 6 of 6
(5,786 Views)