Splash Screens can be a bit of a pain and there were several ways show on the old forum. This has been the easiest way that I’ve found and has the fewest steps.
- Create your main window. You may leave it visible and the Default Window from the App.
- Create your Splash Window (WinSplash for this example). Keep it visible but you may want to choose a different window Type. It doesn’t get any plainer than Plain Box.
- In the splash window, drag a timer. I set the Period in the timer to 3000. Your call.
- In the splash window add Mouse Down and Key Down events in case the users want to click or keyboard out of the splash screen. In both of those events as well as the timer Action event, put the following code:
- In the App, add an Open event and add this code:
WinSplash.ShowModal (If you want to keep the spash screen from showing up every time you run your project in Debug, surround it with this if:
if Left(app.ExecutableFile.Name, 5).Uppercase <> "DEBUG" Then
- All that is left is to be able to open the splash in Help -> About, so for that menu item, the only code you need is:
WinSplash.Timer1.Enabled = False Any reference to an Implicit Instance window will cause it to open, this just turns the timer off so that the user has to click to get rid of it.
Thats about it. I hope it saves someone some time.
You can also use pragmas to avoid showing the splash screen
#If Not DebugBuild Then
I use a far easier way:
I set the splash screen window the default one,
In that window, a key press or a mouse down close the window and display the real main window,
the real main window cannot be closed. If you want to exit, use the Exit MenuItem.
Works fine on OS X too (use Quit instead).
You know, that’s the way I started, but for some reason it wouldn’t put the graphics in the Splash screen that way. Odd thing.
I tried the way in the first post, and I’m finding that consistently my icons in the Toolbar (cocoa) are grayed out until I click anywhere in the window and they show up. Tried all sorts of ways to refocus them etc. Had to give up on the splash for now.
Windows 7 is fine. Cocoa, not so.
Need more time to investigate.
I’m not a fan of splash screens. (Use to be, got over it.)
It reminds me of the early days of the web when you’d go to a site and you’d get a mostly blank page with a “Click Here to Enter This Site” link. It’s an extra step and rather disrespectful of your users’ time and intelligence.
If you have files to load, as do Xojo and Real Studio, then an “I’m getting everything ready to go” splash screen with progress bar is a great idea. If it’s just there to stroke your ego, maybe it’s not in your users’ best interest.
I’m generally not but when the software is in trial mode, I want just a 4s pop up splash. Once registered, they’ll never see it again unless they select “About”.
However I can’t then show the main window with the toolbar icons all grayed out. I ended up using FrontMostMBS which does the trick nicely and gets around the issue. Haven’t got the cycles to debug that little issue
I used to use Splash Screens (App Wrapper features one), but new applications developed this year, I tried something different. I integrated the splash screen into the blank document. It appears to work quite well, I’ve attached an example below from a new app that we’re wrapping up at the moment, the app icon hasn’t been designed so it’s currently showing the “Default” app icon.
This way every time there is a blank window it acts as a splash screen, but it’s also functional. Of course when the user opens the app and it restores existing docs they don’t see the splash screen, but they should know which app it is
I’m displaying a splash screen during a connection and initialization process, in a client/server app. A little text below the Logo is changing and showing where we are, while a progress indicator is turning.
The Window contains a Canvas, a Textbox and a ProgressBar. I’m using a window of type plain box which is made transparent using MBS plugins:
In the open event handler:
#If TargetCocoa Or TargetWin32
I’ve tried but also the controls (canvas, textbox, etc. become transparent !!!
Please, can you help me ?
@Oliver: can you post an example on your website?
My App does not have a default window. From the App NewDocument or the OpenDocument event-handler, I run a method which handles login and initialization. Depending on the situation, I instantiate a WindowSplashScreen and close it when initialization etc is done. During this process, the method repeatedly sets Label1.Text and calls a refresh of WindowSplash…
Here an example project just for showing the splash screen : splash.zip
Thanks! Will have a look this evening.
very cool splash screen…what is the following codes for?? In the paint event.
#If TargetCocoa Or TargetWin32
Dim c As CGContextMBS
If TargetCocoa Then
c = GetCurrentCGContextMBS
g.ForeColor = FillColor
c.ClearRect CGMakeRectMBS(0, 0, g.width, g.height)
ClearRect clears the given CoreGraphics Context with a jpg returned by CGMakeRectMBS - and the whole thing is required to make the call to MakeTransparentMBS work …
Check out MBS examples and docu : MakeTransparentMBS
Thanks Gary McGuire. That worked splendidly!
I’ve tried the Oliver’s sample but in winwos 7 and Xojo 2016r1 doesn,t work
the window context c variable is always null…
I neeed this sample to work also in linux . Is It possible witn the MBS plugin?
Thats because it’s OSX only (I guess)