From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Loading control settings from a different VI?

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.

0 Kudos
Message 1 of 3
(2,175 Views)

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 😉 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 3
(2,157 Views)

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.

0 Kudos
Message 3 of 3
(2,138 Views)