LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

default values for numeric controls

cluster defaults.JPG

My program has a rather large set of frequencies/correction factors that it uses, 95% of the time the frequencies will be the same, but every now and again they will need to be tweaked a little bit, otherwise I would just make them constants.  Shown is a screenshot of the cluster's default values when I open the program, and I am trying to figure out a way to change the values it defaults to.

 

I have tried entering the correct values and then just saving the .vi with the correct values in the controls, but that doesn't seem to work.

 

Another thing to note is that these clusters are controls to a sub.vi, so I imagine I will also have to change the defaults in the sub.vi in order to change the defaults in the main program.  (I tried saving the sub.vi with the correct values in the controls but that doesn't seem to work either.)

0 Kudos
Message 1 of 6
(3,147 Views)

The best thing to do would be to create have file that stores all the values from the clusters and reads the values when it starts up and writes the values back when it finishes.

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 6
(3,140 Views)

Adnan is correct that would be the best way. But if you don't want to have to deal with creating the file, loading it, and writing it to the values, you could do it other ways. First some questions though.

 

Did you want to change the values while the VI is running?

Is this going to stay a VI or are you planning on making an executable out of it?

 

You mentioned that you tried changing the values and saving the program. That didn't work. What you needed to do is change the value, right click on each control you change and select "Data Operations -> Make Current Value Default". Then when you save the vi it will keep your changes. This of course does not work while running the vi or for *.exe.

 

Disclaimer: this works for Labview 8.6.1. any other version may have a different way to change the default value.

Message 3 of 6
(3,133 Views)

Hmm, so if I make this .vi into a .exe then it won't have any default values?

0 Kudos
Message 4 of 6
(3,096 Views)

@LarsUlrich wrote:

Hmm, so if I make this .vi into a .exe then it won't have any default values?


All controls have default values, even in an exe. They will be the same as in the VI as configured and saved.

 

(Of course in an exe you will not be able to change the default values later to some other default values after the build. Unless the defaults should be permanent, you need the ini file approach.)

Message 5 of 6
(3,089 Views)

Ok thanks, that clears it up for me.

0 Kudos
Message 6 of 6
(3,087 Views)