LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving and loading of specific front panel controls

Solved!
Go to solution

Hello there,

 

I found this example to save front panel control values. It used an invoke node with "Ctrl Val.Get All (deprecated)". With a bit of research, I found that I had to adapt it, using the "Ctrl Val.Get All" and changing the data type to variant. The saving works (at least, something's saved), but when trying to load the file, nothing works (strangely enough, it worked with the (deprecated) version of the invoke node). So obviously I must have done something wrong, but I can't figure out how exactly I should have changed the data types. The version I came up with is attached.

 

But the main question is this: how do I do this to save only certain controls? This invoke node saves every control value, so I'm guessing I'll need to use the "Get Value" node, but I don't know how to use this one, either. Maybe the problem resides in my first question and I just need to send a string with all the control values I want to get, but this is so you can see where I'm trying to go.

 

Thanks and have a nice day.

 

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

Hello,

 

Here's a start for you, if you want to specify which controls you want to save the default value.  You can reverse the logic to load the control value and assign values.

 

fpctr.png

 

 

Message 2 of 8
(3,470 Views)

Thanks a lot! I've tried combining and cleaning up both VIs, works fine for the controls you've chosen (the booleans). But when I try to add the string control (e) to the "ControlNameToSave" array, I get the error message ("the control with the name e..." as from the example VI). It's getting added to the variant array that's saved to the file, but the VI fails to load the saved value for e. Any thoughts on this?

0 Kudos
Message 3 of 8
(3,438 Views)
Solution
Accepted by topic author Leukocyte

There's an example here which shows the whole process - https://decibel.ni.com/content/docs/DOC-15349


___________________
Try to take over the world!
0 Kudos
Message 4 of 8
(3,431 Views)

Hello Leukocyte,

 

If you want to finish what you have started you have to use the "Invoke Node" set value as shown below.

 

invokenode.png

 

 

Message 5 of 8
(3,417 Views)

Your code did not work because you were probably trying to write the label which is not allowed.  Since you have a reference on the control you can do as below also (without writing the label.text):

 

invokenode2.png

Message 6 of 8
(3,413 Views)

Hi Leukocyte!

 

Nice to see you are experimenting with this!

 

It is not completely clear what you want to do. If you want to save a specific value from  the front panel you must use the Crtl Val.Set or Crtl Val.Get Here the "all" must be left out, otherwise you are still trying to save or load all objects. Also take in mind that when changing one of these events, the save or load, that you will need to change the other with it. Otherwise it will be incompatible and you will see as you mentioned that it will not do what you want. Also ask yourself what application do you need to build, because is it simply 1 value 1 time or different values, different times. So take a good look at the design part and let me know how this works out. If I dont understand good how the application will be used I cannot give the best solution.

 

I hope to hear from you.

 

Beste regards,

 

Collin de Wit
Applications Engineer
National Instruments

Message 7 of 8
(3,368 Views)

Hey there!

 

As soon as I took a look at tst's suggestions, I completely forgot about this thread (sorry about that!) as it does exactly what I want it to do (after heavy modifications, of course, but the principle stays the same). Thanks to everyone for your kind suggestions and have a nice day!

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