LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make run-time front panel controls non-volatile

Is there a proven method for making front panel controls non-volatile in a run-time environment ?
In other words, I need the controls to remember their setting when the user exits the application and then returns to the application.
Thankyou
0 Kudos
Message 1 of 9
(3,599 Views)
Yeah, there's a few ways.  One of which is invoking the "Make Current Values Defualt" method at application exit, and calling it at startup as well, but with "Reinitialize to Default".  See the attached image.  You need to be careful with this though as it will do it for ALL controls.

Alternatively, you can make a file which you write all the values to at application exit, and on startup, read back the file and populate the controls.  This is a more robust solution, but is also a bit more work (still pretty straightforward though).

Hope this helps


Message Edited by Will.D on 11-14-2006 12:05 PM

0 Kudos
Message 2 of 9
(3,594 Views)
Does this apply to run-time? I think your solution will only work with the development environment...

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 3 of 9
(3,587 Views)
Well I know for sure that "Reinitialize to Default" works in a built application, since I use it for a few applications.

I suppose "Make Current Values Default" may not, as I have never tried it in a built app, but I assumed it would since "Reinitialize..." works.
0 Kudos
Message 4 of 9
(3,580 Views)

Hi,

  absolutely correct - you cannot use the Make Current Values Default when the vi is reserved for running.

What you need to do is get a handle to the front panel, then get the controls[] array from that reference.

Then you can cycle through that array and convert the values to an xml format, or an .ini file as you require (or even the registry).

You'd therefore need a load up section to the vi to handle the re-instating of the values on the next run of the vi.

THis technique is mentioned here but no vi's are provided :
http://zone.ni.com/devzone/cda/tut/p/id/3964

The alternative is described here, where you effectively launch your vi from another one using vi server, that way you can get access ot the edit time version of the vi.

http://zone.ni.com/devzone/cda/epd/p/id/1173

Hope that helps

Sacha Emery
National Instruments (UK)

// it takes almost no time to rate an answer Smiley Wink
Message 5 of 9
(3,552 Views)

Thanks everyone for all the suggestions so far.

Sacha, do your methods work with a built application ?

Aaron

0 Kudos
Message 6 of 9
(3,551 Views)
My apologies.  I should have double checked that "Make Current..." works as well as the "Reinitialize to..." during runtime.

I guess I just assumed that if one worked, why would the other not?
0 Kudos
Message 7 of 9
(3,542 Views)
Well,

what you would do is edit the vi and save it (thus recompile) The RTE can't recompile, and you would edit the executable that is also a NO-NO

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 8 of 9
(3,533 Views)
The most robust way is to have your program read in a file (ini or xml) and populate the controls and then at the end of your program write the control values back to the file for the next time. Or you could one up yourself and have it load the defaults and let the user change what he/she wants and give them the ability to save and recall the settings with the ini or xml.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 9 of 9
(3,517 Views)