Hi Leif,
Unless I am Mistaken, you want to set the current values of controls in a Panel to Default. It is Like User Having Control when next time the Panel Opens, What Values it will have. This is especially useful if you want to store Instrument Addresse, Specifications etc.
One Method is to Use INI or Registry files to hold your Values. And Read them when Panel is Opened and Update them when Panel is Closed.
But the Challenge is to not use the file and use "Make Current Values Default" Method to do this. Keep the Following Issues in mind.
1. This Property can be Used on a vi provided the VI is not running. So if you use this Property in the Program section of VI, it will not Work because a VI cannot save itself when running. Lets call this Vi "Main.VI"
2. You have to "Dynamically Run" another Vi(Lets Call it "Save Defaults.vi") which will then save the Current Values of your Main VI. The Most Important Information for this VI is the Path of the Main.vi
3. When you Want to Pass the Value of Path you Must use Invoke Node With Flatten to String Function. Instead of Putting this in my "Main VI". I created another vi( call it "Run Save Defaults.vi") The Input to this new VI is path Information from the Main.vi.
The Advantage is I can Just use the "Run Save Defaults.vi" form any VI, by just wiring the Path to it. It will call the "Save Defaults.vi" and Perform necessary task.
All these Concepts are best illustrated using 3 VIs Attached.
The "Make Value def Example.vi" is the Main VI.
This VI Calls "Run Save Defaults.vi" with its current value of path. The "Run Save Defaults.vi" takes the Path and Dynamically calls "Save Defaults.vi" and also dynamically passes Path Information of the Main VI. It then ends and in effect ends the Main VI.
The "Save Defaults.vi" now Has the Path Information of the Main VI. It first Checks if the Main VI has ended.
It then Proceeds to Save the Default Values and Close this VI. On Success it Closes itself or Displays Error Message.
Two things to Keep in mind.
1. Make sure you save all three VIs in same Subdirectory. The two Subvi's use the reference of main VI path for acccess.
2. The Main VI "Make Values Def Example.vi" must be Top Level. It cannot be Called by another VI. If you need to Call this Vi then you have to dynamically call it using the "Run Vi" Method.
I Hope you can take it from here.
Good Luck!!
Mache
Good Luck!
Mache