LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make the current values in the frontpanel as standard values (in an exe-file)?

Solved!
Go to solution

There are some posts to this topic, but I couldn't find a satisfying solution to this.

 

Simply example for what I am looking for a solution: The fronpanel includes one numeric input element. I start the VI, change the value of the numeric input element to an other value and than stop the VI. The next time I start the VI I want the numeric element to have the value that it had when the VI was stoped. Preferably, I want the value of the numeric element be setted up as "standard-value"  when I push a button (see the example attached).

 

Thanks.

0 Kudos
Message 1 of 8
(3,080 Views)

If you build an exe from a VI, the actual default value of a numeric control (or any other entity) cannot be changed any more. This is not LabView specific behaviour actually, how do you want your program (the exe file) to change itself? 🙂

 

But there is an easy workaround for this, you can use configuration files. There are many examples, you can use csv, xml, ini, and many other file types and methods.

A possible way to do this: when the user closes the applications, you take the actual value of the control, and save this value to a config file. When the user runs the exe again, the program loads the config file, and changes the default value of the control into the value which was stored in the file.

Of course you can make config file read/write even optional, with multiple configuration files...Just think about other programs which we use daily: they work in the same way...

0 Kudos
Message 2 of 8
(3,061 Views)

The MGI Toolkit (free, available in VI Package Manager) has VIs for 'Save Front Panel to INI File' and 'Load Front Panel from INI File' functions - when called it will write the state of the front panel to a file and then you can load the values from this file again at launch.

 

If you don't want to save all of the controls/indicators, you can do it yourself by writing the values to a file yourself. Have your VI try to read the values from a file and have an event structure for your 'save' button which gets the values of the controls you want to save and writes them to a file.

 

One way to do this would be to create/get references to the controls you want to save and using a property node to get the 'Label' and 'Value' properties which you can write to the file.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 3 of 8
(3,058 Views)
Solution
Accepted by topic author J!

I put together a very basic example, which should give you the idea. Find it attached (this subVI only works with doubles).

Of course the toolkits which Sam_Sharp mentioned are much more "pro" solutions with much more options...

Regards!

Download All
0 Kudos
Message 4 of 8
(3,038 Views)
Solution
Accepted by topic author J!

hmm, out of edit time 🙂

I have attached a bit different mainVI which is closer to what you want I beleive...

Regards, 

Message 5 of 8
(3,025 Views)

Thanks, that is exactly what I was looking for.

0 Kudos
Message 6 of 8
(3,015 Views)
Solution
Accepted by topic author J!

A good example Blokk, you can modify it to work with any control with something like the following:

2014-11-27_14-16-04.png

 

(Obviously you need to sort out the errors and references, open/close the config file, wrap it up into a SubVI, error handling etc.)


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 7 of 8
(3,009 Views)

yep, this is the pro solution, more universal...

0 Kudos
Message 8 of 8
(3,003 Views)