LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling active display from another VI?

Hi,
I have a VI that needs to serve the purpose of selecting different display screens. The selction process is just one enumeration that should keep one screen up at a time, but I have no idea how to code it such that is the case. I could bring up the different subVI's in a case statement but is there any way to close them and re-open them without restarting the whole process? Please let me know if I'm not being really clear.
0 Kudos
Message 1 of 12
(3,648 Views)
Right-click on your SubVI, select "SubVI Node Setup..."
Then you have options for opening Front Panel, showing it, closing it, etc.
I believe this is what you're after, or could be coded for such.
Good luck with it, Doug
0 Kudos
Message 2 of 12
(3,648 Views)
Thanks, yeah I am definitely interested in coding everything ahead of time such that when my main menu pops up it will just be used to select an active display. So say I have Display 1, 2, 3 then when I select 1 it would be brought up, and then when I select 2 ideally 1 would be closed and 2 would be brought up. So then if I select 1 again 2 would be closed and 1 would be brought up. Is this possible? I'm thinking I would need to use some kind of global variable to keep track of what display is active at any given time?
0 Kudos
Message 3 of 12
(3,648 Views)
How about...if your SubVIs have their own while loop, where they keep running until the user stops it OR until your SubVI detects another panel.
'OR' these two checks into the loop run/stop terminal.
To detect if another panel is chosen, wire in the enum value - which could be wired directly or via local variable; have part of your SubVI loop do a read of that value and compare for either a stop or a panel number check. Then, if the SubVI is stopped (closed), and if you had set up your subVI node per my previous answer, you should be ok.
Doug
0 Kudos
Message 4 of 12
(3,648 Views)
I have been able to bring up a subVI from my main VI and then close it on the fly by setting the subVI properties to Open front panel when called and Close afterwards. Now what I can't seem to do is to repeat this process. It comes up opened and then I can close it and the front panel of the subVI closes. (all good) But then when I change the enumeration on my main VI to display another panel it does not? So I have been able to do what you said once but not again, now is this because there is something wrong with the way I'm setting my enumeration or are your 1st 2 comments sufficient to achieve my goal.
0 Kudos
Message 7 of 12
(3,648 Views)
Helper,
It may be time for you to attach some code so I/others here can take a peek. I bet you're close, but its a data flow type issue now. The key is to be able to keep checking on the enum value and process from there. Cases in a 'Main' while loop is probably sufficient; but your getting close to a state-machine type design need; however, not certain without seeing all your code and how this part fits.
Let us know, Doug
0 Kudos
Message 9 of 12
(3,648 Views)
Thanks for all your help. I have been able to pinpoint my problem directly to the fact that my enum is being read once upon start up and then its value is just not getting updated, no matter how many times I manually switch the control. I can't attach my code, but I'm sure there are similar posts on this website that I can look into. I tried having my enum in the main while loop and also in a parallel while loop, still no use. I am beginning to think that maybe the problem is that I use the enum control to update a global variable and also to read from that global variable.
0 Kudos
Message 10 of 12
(3,648 Views)
You can open & close sub-vi's programatically with the 'application control' choices on the Functions menu. But have you considered just using the tab control, and putting all your displays in the same vi? It's clean and easy. On the front panel Control menu, look under 'array & cluster'. Hope this helps.

Cheers,
Bill Kemmerer
0 Kudos
Message 5 of 12
(3,648 Views)
Thanks, can you be a little more specific as to how I can use the application controls? The basic gist of my problem is that I have one main VI with an enumeration control on it (Display 1, Display 2, Display 3 as the choices). Now when this main VI loads I want it to load Display 1 (because that is my default choice), then the hard part comes when the user selects Display 2. I want the Display 1 VI to close and have Display 2 open... and so on. I don't have a clue as to what application controls to use and where to use them. If you could help that would be greatly appreciated.
P.S.
I can't use the tab controls even though that does seem like a good suggestion.
0 Kudos
Message 6 of 12
(3,648 Views)
Well, this was my first answer on these forums, and I am a bit embarrassed since I could not get it to work the way I described. I do think it's possible the way I mentioned, but there is another way.

There is a 'close panel no abort.vi' in the labview\vi.llb\utility\victl.llb library that will let you close the displays. You will also need to set up the display vi's so that they open when called, but don't close when done.

I am attaching a simple example. If you can't read version 6.02, let me know and I will upload a version 5 example.

Good luck,
Bill Kemmerer
0 Kudos
Message 8 of 12
(3,648 Views)