04-23-2013 11:38 PM
This question is a bit difficult to explain, but I'll try.
I have a main program (main.vi), and a sub vi (setup.vi) that loads the front panel in order to do setup. The setup.vi has the option to "save settings", in which it writes all of the controls to a .txt file. When I click "done", the setup.vi builds a cluster with all of the parameters in order to easily pass all of the information in to main.vi.
Now, when main.vi loads, I want it to be able to read the default setup from setup.vi, and build the same cluster from that data - and I am having a difficult time figuring out how to do it. I have attached the sub-vis that setup.vi uses to both save and load the controls. They are fairly simple.
04-24-2013 04:01 AM - edited 04-24-2013 04:02 AM
How about adding an boolean input 'silent default' to your setup.vi, that if true, just loads the default and doesn't need the user action?
Try to keep one action in only one vi. So if you need changes, there is only place to go 😉
04-24-2013 02:38 PM
Thank you for your reply. I am using a state machine type program, and the "initialize" state will load the default settings. The problem is that there are two separate VIs - and the controls from the "setup.vi" don't exist in the main vi - only a cluster with all of those controls inside.
One solution is to create the cluster within setup.vi just before writing it to the disk, but that is extremely cumbersome for several reasons. Basically, I'm looking for some way to translate Control Name (from loading) -> Cluster Element Name so that I can make the values match.