LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing default values in Labview 7?

Does Labview 7 have an easy way allow the user at runtime to change the default values of controls? So the user has to enter it once and labview 'remebers' it next time it's run?

So far in 6.1 Labview makes you write some .ini file it writes to, then reads from. or have some nature of 'wrapper' .vi that can stop the main .vi and use the save current values as default option.

Does Labview 7 have an easier solution?
0 Kudos
Message 1 of 5
(3,328 Views)
There is no automatic way to do this. You can:
Goto operate >> make current values default for the VI. Likewise you can do this specifically for a singel control by right clickin on the control >> data operations >> make current values default. Be sure to save.

As you stated, you can use an initialization file or the more advanced technique of coding to make the VI to this for you automatically. The trick is to use VI server to dynamically launch a second VI that waits until the first is through executing to run the VI server method of making values default on the first VI. It is a tricky bit of coding--I have seen it done but I have no examples to give you.
0 Kudos
Message 2 of 5
(3,328 Views)
I need the user to be able to set the default values at run time, neither of the first suggestions are avaliable at run time.

I'm trying to use the configuration file option, but there's a lot of controls involved, so it's turning into a mess. if you come up with any examples of the bit of tricky code you allude to, i'd love to see it. Thanks -

(yeah, i kinda hoped that LV7 was going to make this easier)
0 Kudos
Message 3 of 5
(3,328 Views)
You have to understand that the default values have to be stored somewhere on disk if you want them to be available for the next run. That is true for any programming langage. When you "Make current values default" either by menu or programmatically, these default are stored in the VI itself and it has to be saved on file. That is why you can't do this while the VI is running and in the Run-Time Engine (it does not have the capability to save VIs).

Saving all front panel data of a VI can easily be done storing the output of "Get All Controls Values" on file at the end of the VI execution. When the VI starts later, it reads the file and uses "Set Control Value" in a loop to restore values. On OpenG.org the VariantConfig tool allows to s
tore all Front panel values to an INI file.


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 5
(3,328 Views)
Ariel wrote:
> Does Labview 7 have an easy way allow the user at runtime to change
> the default values of controls? So the user has to enter it once and
> labview 'remebers' it next time it's run?
>
> So far in 6.1 Labview makes you write some .ini file it writes to,
> then reads from. or have some nature of 'wrapper' .vi that can stop
> the main .vi and use the save current values as default option.
>
> Does Labview 7 have an easier solution?

Ariel,
On my web site, I have examples of two of the suggested methods for
dealing with this. The Save Front Panel Defaults program is a
convenient way of using VI server to save the front panel control
defaults after the program is over. All you need to do is insert one VI
at the end of your main pr
ogram.
There is also a set of Configuration File VIs that describe one way
to write .ini files that helps minimize maintenance issues. It still
takes a good bit of programming to implement, but once you have the main
structure, it is pretty easy to add more parameters.
Finally, as Jean-Pierre said, OpenG has some good tools for config
files that are even more automated than mine.

Regards,
Dave
-------------------------------------------------------------
David Thomson 303-499-1973 (voice and fax)
Original Code Consulting dthomson@originalcode.com
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Developer
Certified Instrument Driver Developer
-------------------------------------------------------------
Research Scientist 303-497-3470 (voice)
NOAA Aeronomy Laboratory 303-497-5373 (fax)
Boulder, Colorado
dthomson@al.noaa.gov
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary,
and those who don't.
Message 5 of 5
(3,328 Views)