Splash Screen - Yet Again

  1. last week

    Dave S

    Dec 1 San Diego, California USA

    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...

  2. Tanner L

    is not verified Dec 1 Pre-Release Testers to.on.ca

    I'm using this in app.open 19r1.1 :

    Dim w As AboutWindow
    w = New AboutWindow(True)
    w.ShowModal

    The True constructor just triggers an auto-close timer in AboutWindow. AboutWindow is a modal dialog.

  3. Norman P

    Dec 1 Pre-Release Testers, Xojo Pro under a bus

    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

  4. Dave S

    Dec 1 San Diego, California USA

    Ok... by changing to a Modal Dialog and using Show Modal.... the dialog does now appear

    but if IN that window I issue a "SELF.CLOSE".... the program bombs
    there is no "timer"... I just place it after all the tasks are completed

  5. Scott C

    Dec 1 Pre-Release Testers, Xojo Pro Vancouver, Canada
    Edited last week

    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.

    I hope that helps.

    Edited for grammar.

  6. Tanner L

    is not verified Dec 1 Pre-Release Testers to.on.ca

    @Dave S Ok... by changing to a Modal Dialog and using Show Modal.... the dialog does now appear

    but if IN that window I issue a "SELF.CLOSE".... the program bombs
    there is no "timer"... I just place it after all the tasks are completed

    I'm just using me.close in the keydown and mousedown events. Try that instead of self.

  7. Dave S

    Dec 1 San Diego, California USA

    @Tanner L I'm just using me.close in the keydown and mousedown events. Try that instead of self.

    that requires user intervention

  8. Karen A

    Dec 1 Pre-Release Testers
    Edited last week

    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

  9. Dave S

    Dec 1 San Diego, California USA

    @Karen A 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

    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

  10. Derk J

    Dec 1 Pre-Release Testers, Xojo Pro

    You may wanna try setting
    http://docs.xojo.com/Window.DefaultLocation
    To window.mainscreen

    It is probably waiting for the app's main window to show first depending on the OS.

  11. Karen A

    Dec 1 Pre-Release Testers

    @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

    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

    - karen

  12. Dave S

    Dec 1 San Diego, California USA

    Karen.... all the Init code is in the OPEN EVENT of the Splash screen
    with a timer at the end to close the window....

    However.. in the short demo I tried to make.... I replace the actual "init code" with a sleep loop
    and the d*mn thing worked perfectly.

    So I'm going to try your idea about having Splash.Open fire a timer to do the "work"

  13. Dave S

    Dec 1 San Diego, California USA

    THAT worked..... convoluted. but it works.. .now to find the minium time settings to use

    Splash Open... fires a "Timer_to_Run"
    Timer_to_Run action does all the tasks
    and at the end it fires Timer_to_Close which then closes the splash

    Thanks Karen you post pointed me in a working direction :)

or Sign Up to reply!