04-24-2020 11:23 AM
My main VI will pop up a subvi for setting parameters. So far the subvi works as designed: when the main VI run it, it will pop up, and it will close itself when I finish using it and the data is passed to the main VI.
My question is: while the main VI is running, each time when I use the subVI I have to reenter the control values, Is there a way to let the SubVI to keep the last setting on the controls?
This is essentially same as: open the subVI in first, then run the main VI such that the subVI never close the window. Or same as the SubVI is always run in memory and never close.
I know I can use global variable or let the main VI to keep the settings, but is there any other simpler method?
Thanks!
Solved! Go to Solution.
04-24-2020 11:59 AM - edited 04-24-2020 12:00 PM
We cannot debug descriptions, because you leave out many details. Attach a simplified version of your VI instead.
(How are you "calling" the subVI? Are connectors assigned, etc. etc.)
Controls keep their value for the current session (panel open or not) unless you have them assigned to the connector pane. Do you?
If they have assigned connectors, controls are expecting values from the caller, of course.
04-24-2020 12:21 PM
Hi,
I have attached the simplified VIs.
Basically the main VI will run the subvi to get a array each time for plot. The SubVI will pop up when called, then I can enter parameters about how to generate the array, then I click "Set" the subVI will return the generated array and exit.
The problem is each time when the SubVI pop up, the controls will reset the value to default, but I want they keep the last values.
I know there are many ways to achieve this, say global variable, let the main VI to store the subVI setting and pass it each time the SubVI is called. But is there a simpler way?
Guang
04-24-2020 12:48 PM
@gy10c wrote:
Hi,
I have attached the simplified VIs.
WARNING!!!! Don't run those VI's. I ran the VI and it proceeded to lock up those windows. I couldn't abort or close any windows.
04-24-2020 12:54 PM
One problem is that you used obvious names for the VIs. My downloads folder already contains several "subVI.vi", so the browser named it subVI (4).vi and the main VI will call something completely unrelated, i.e. another random subVI from years ago.
04-24-2020 12:58 PM - edited 04-24-2020 12:58 PM
As I said, you need to disconnect these controls from the connector pane. Have you tried?
(also, use a shift register instead of a local variable in the subVI)
04-24-2020 01:06 PM
Like this.
04-24-2020 01:11 PM - edited 04-24-2020 01:16 PM
"
@RavensFan wrote:
@gy10c wrote:
Hi,
I have attached the simplified VIs.
WARNING!!!! Don't run those VI's. I ran the VI and it proceeded to lock up those windows. I couldn't abort or close any windows.
This is not my problem. If you set the VI property to be "show front panel when called" AND your subvi is opened when you run the main vi, it will lock. To unlock, right click the vi icon in the windows taskbar, then close, then labview will close everything and allow you to save.
04-24-2020 01:19 PM
@altenbach wrote:
As I said, you need to disconnect these controls from the connector pane. Have you tried?
(also, use a shift register instead of a local variable in the subVI)
Hi,
Just tried this, Yes! if the controls I want to keep last values is actually not attached to the connector pane, these controls will keep same value as long as the main VI is running.
Thanks!
Guang
04-24-2020 01:24 PM
A few more suggestions: