LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store Control Properties for subsequent launches of program

I have a cluster of buttons.  Each button event causes a test to run.  I color code the buttons that have been tested pass(green)/fail(red). The problem is that I want to store the progress even after the program is shut down.  Maybe I could store the button control property COLOR[4] inside XML for use when I run the program at a later time.  How can I do this?

0 Kudos
Message 1 of 10
(3,316 Views)

When passing the control to XML and back, it only passes the value. 

0 Kudos
Message 2 of 10
(3,289 Views)

If you are running your program "in Development mode" (meaning you start LabVIEW, load your VI, then push the Run button), you can use the property of the VI "Make Current Values Default", which will set your controls so that the default value (when it is next run) is the current value.  No muss, no fuss.

 

Bob Schor

0 Kudos
Message 3 of 10
(3,274 Views)

It's going to be deployed as exe.  Any way to do that in Run-time?

0 Kudos
Message 4 of 10
(3,267 Views)

Need to see executable code (no pictures of code, please).  That will help determine what you really mean by your colored buttons, and once we know, we can make suggestions.

 

Bob Schor

0 Kudos
Message 5 of 10
(3,255 Views)
Yes when you flatten to string (any kind) all you get is the value. If you want properties also, you will need to write a bit more code. Here is an example that might give you some ideas.

http://www.notatamelion.com/2015/06/22/helping-a-window-to-remember/

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 10
(3,231 Views)

I'd take a look at ini files.  Save the information you want the button to hold onto in the ini file and create an initialization state at the beginning of your code to read from that ini file and setup the buttons as you want to see them.

0 Kudos
Message 7 of 10
(3,222 Views)

If you install the OpenG toolkit (free through VI Package Manager), there are VIs that can save/load the values of controls/indicators on a front panel to an INI file.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 8 of 10
(3,133 Views)

Just a suggestion if you use the LabVIEW installer. Writing to the application directory (Program Files) requires Admin permission in Win7. I don't like creating applications that require this.

 

Keeping this in mind, I go with two options

  1. Write to an INI file in the user's data directory
  2. Write to the Registry in HKEY_CURRENT_USER (I know, I know, the registry scares a lot of people)

Personally, if the user doesn't need to edit it, I go with the registry. It's what nearly all commercial programs do. It also allows a per-user experience.

I'll toss in my current VI's with two caveats.

  1. Make sure you clear the errors on read. If the value doesn't exist, it will error (i.e. on a new install). If the conversion doesn't work, it will error. Users typically don't need to see an error for something as simple as defaults.
  2. Use with a small bit of caution. If the label or application name keep changing, it will keep creating new registry entries. I would only toss this in when your design is stable

 (P.S. I know these only do value. I just wanted to give an example. You'll have to adapt slightly to your color requirements)

 

I wouldn't mind hearing what other people think.

Josh
Software is never really finished, it's just an acceptable level of broken
0 Kudos
Message 9 of 10
(3,108 Views)

"Just a suggestion if you use the LabVIEW installer. Writing to the application directory (Program Files) requires Admin permission in Win7. I don't like creating applications that require this."

 

If you 'unlock' (from the installer build spec settings) the installation directory users will be able to read/write files in the program files directory.

 

This is not recommended practice though - the user data directory is the Microsoft preferred location for these sorts of things.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 10 of 10
(3,091 Views)