06-16-2015 01:59 PM
@ijustlovemath wrote:
I was thinking about that! Can I use property nodes to set default values?
There is a property node to do that but it only works while in EDIT Mode. I've tried to use it to save defaults on program exit but the property node errors out since the VI is in RUN Mode at that point. I don't know what that property node is intended for.
06-16-2015 02:00 PM
NI, why must you tease us with such features!
06-16-2015 02:21 PM
@NIquist wrote:
@ijustlovemath wrote:
I was thinking about that! Can I use property nodes to set default values?
There is a property node to do that but it only works while in EDIT Mode. I've tried to use it to save defaults on program exit but the property node errors out since the VI is in RUN Mode at that point. I don't know what that property node is intended for.
One word: Scripting
06-16-2015 02:29 PM
What is stopping you from creating your own INI file with some default starting parameters or even downloading it from somewhere?
06-16-2015 02:30 PM
Nothing, I just thought it was a sort of messy way to handle it. I figured there was a better way that I didn't know about.
06-16-2015 02:42 PM
That is what I would do. Then if your parameters change, write that back to the INI file and you're in business for the next time that system runs again.
06-16-2015 02:54 PM
@crossrulz wrote:
@NIquist wrote:
@ijustlovemath wrote:
I was thinking about that! Can I use property nodes to set default values?
There is a property node to do that but it only works while in EDIT Mode. I've tried to use it to save defaults on program exit but the property node errors out since the VI is in RUN Mode at that point. I don't know what that property node is intended for.
One word: Scripting
Again, ONLY AVAILABLE IN EDIT MODE. 😉
Applications generally do not modify themselves. Changing the default value of controls or constants inside a running application would require modifying the executable, which then causes all sorts of problems.
06-16-2015 03:57 PM
That makes sense. I was wondering how it might work should I compile it as an EXE.
06-17-2015 10:29 AM
For an EXE you're pretty much going to need to write to an external file on program exit and read it back on initialization. The config VIs in the File palette create nice keyed text files that can be read and modified by any text editor. XML files can also be used and there are registry tools in the Connectivity palette where you could write configuration data. These are all pretty standard methods used by a lot of software today. Another advantage of config files is that you can keep multiple configuratons and change your program defaults by simply reading in a new file. Of course you have to program that functionality in yourself.
06-17-2015 10:01 PM
Does the fact that LabVIEW stores its 'configuration" data (such things as the list of Projects and VIs shown in the Getting Started with LabVIEW opening screen) in a Configuration file (specifically, in LabVIEW.ini) should tell you something. Also, NI provides (in the File palette) a series of VIs for manipulating Configuration files. However, if another file type (Excel, .xml, text) suits your fancy, why not? It's just that there is already some "logic" built into the Configuration VIs ...
Bob Schor