First off… this is similar to what Xojo does… show a screen while things are loaded and initialized which takes a few seconds
I have a window [winSPLASH] it is simply a visual… no progress bars or anything that needs to be updated while its displayed
In the App.OPEN (and I tried in the App.Activate as well)
Dim w As New winSplash
w.show
..... Do the stuff that needs to be done
mainWindow.SHOW // show the actual first window of the app
w.close
The app runs… debugging SAYS that winSplash is Displayed and closed… but it is never visible… nothing happens on the screen for the first few seconds, then bang MainWindow appears
According to my logging… winSplash stays open for 2.3 seconds
I have tried winSplash as implict, and not
also tried by having it the default window, and leaving the “new” part out
all gave the same results…
depending on what it is you’re doing IF the main event loop never gets a chance to run again because you have busy loops that do not yield you can end up with the window getting created but never actually showing - exactly the symptoms you’re saying you have
one way to deal with this is to resort to a pile of DoEvents calls (which I would NOT recommend)
while it might “work” it allows all kind of oddities because of how DoEvents works
another tactic is to move all the loading and such into a thread that uses a timer to periodically update the splash screen and then, when the thread is about to end, again uses a timer to close that window and move on to your main screen
or you could use the TASK example & Class or in 2019r2 the UI update events that got added to the thread
I’m sure there a few different ways to do this, but what I did in one of my projects was the following:
1.) - My App “Default Window” is set to my StartUpWindow (splash screen)
1.b.) - StartUpWindow Implicit Instance = True
2.) - My StartUpWindow does contain a progress indicator that is managed by a Thread.
3.) - In the StartUpWindow, when the Thread.AddUserInterfaceUpdate event is notified that all start up activity is done, then I call MainWindow.Show
3.b.) - MainWindow Implicit Instance=True
4.) - The StartupWindow AddUserInterfaceUpdate Event also fires a Timer to delay a call to Self.Close, so the two Windows overlap slightly.
The above allows me to see the StartupWindow clearly for a couple of seconds, with the progress running, before the MainWindow is opened.
Note: I also use App.SleepCurrentThread(50) in the StartUpWindow Thread to purposely slow down the progress, so the splash screen is not just a quick unreadable flash on the screen.
Why not run the initialization from Splash Window open event (or a single use timer started there if that does not work), and when done show the main window and close the splash window from that code
[quote=465563:@Dave S]That IS what I’m trying to do
In a few minutes I hope to post a simple demo project showing how/what I am trying to accomplish[/quote]
No, you are doing the initialization in app open… I am talking about either putting the code in SplashWindow.Open Or in a single shot timer action event started in SplashWindow.open… thinking about it the latter would likely have the best chance of working. That way the Splash Window would definitely be finished opening