LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Main" VI for application

Solved!
Go to solution

Hello,

 

I am writing a LabVIEW application where I have a VI similar to the main() function in a C program which executes when the application starts (i.e. the Startup VI).  I do this to load prerequisites like a logger and other configuration before the actual main application code begins to run.  This Main.vi then opens my MainWindow.vi which has the main GUI for the application.

 

I am attempting to build an executable from this program but am having issues properly opening, keeping open, and closing the Main VI.  I first attempted to just close the Main VIs front panel when it runs but this causes the whole application to abort.  Next, I read that you can call the Front Panel Open method with the Hidden attribute.  This works, however, when I close my MainWindow.vi (which then feeds its output back to Main.vi) Main.vi still continues running for some reason even though it is done executing.

 

This is what I currently have for Main.VI which executes MainWindow.VI

image.png

 

Is there a correct way to go about something like this?

 

Thank You!

 

 

0 Kudos
Message 1 of 5
(3,065 Views)

1. Instead of the Application Kind property node with a case structure, use a Conditional Diagram Disable Structure.  You can set the key to be Runtime Engine==True to hide your front panel.

2. Do the same as 1, but use an invoke node to close the front panel of the main VI after the other VIs are done running.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(3,056 Views)

What you are looking for is a "Splash Screen"

Mark's "Splash Screen in Main.vi" is about as easy as it gets.  Be sure to tell him I sent you.

 


"Should be" isn't "Is" -Jay
Message 3 of 5
(3,054 Views)

@Jeff:

     Thanks for the link to Mark's Splash Screen code and demo -- the comments are also worth following.

 

     I think you "inverted" the Logic discussed by the Original Poster, but I must say I'd "do it your way".  As I understand the OP, he wanted "Main" to be a (temporary) loader that would do initialization, then start the "new Main Window" that runs the real application, not (necessarily) returning to Main, but not being sure how to get rid of it.

 

     Your way would be to have Main run an Initialization routine (which could simply run as a Modal Window -- hogging the entire Screen until it finished, passing whatever persistent data it collected, such as File paths, RefNums, parameters) to the Main, then simply be ignored.  I'm pretty sure that Splash Screens are also designed to be "Now you See Them, Now they're Gone".  Much simpler logic, in my humble opinion.

 

Bob Schor

0 Kudos
Message 4 of 5
(2,987 Views)
Solution
Accepted by topic author patrick.wright

Thanks for all the feedback.  I went with the splash screen idea but made a simpler version for my application with the following code.image.png

The my front panel is just an image with some text that is set to be borderless and start in the middle of the screen above all other windows. 

 

 

0 Kudos
Message 5 of 5
(2,917 Views)