Splash screen while app is loading

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Splash screen while app is loading

Postby Dare » Thu Jun 11, 2020 5:45 pm

Hello,
My application takes a few seconds to load, and the window's content stays white while loading. I want to display some kind of a simple splash screen instead. What is the most straight forward way of doing that?
Dare
Techie
 
Posts: 14
Joined: Fri Mar 15, 2019 9:40 am

Re: Splash screen while app is loading

Postby HarmlessDave » Fri Jun 12, 2020 12:26 pm

What platform?

In Windows you could create a separate splash screen window and display it over the main window.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Splash screen while app is loading

Postby Dare » Fri Jun 12, 2020 4:47 pm

HarmlessDave wrote:What platform?

In Windows you could create a separate splash screen window and display it over the main window.

I'm building for Windows. Thanks for the answer, but is there some way to hide the main window until the content is rendered (page is fully loaded)?
Dare
Techie
 
Posts: 14
Joined: Fri Mar 15, 2019 9:40 am

Re: Splash screen while app is loading

Postby HarmlessDave » Sat Jun 13, 2020 2:59 pm

A full screen sized splash screen? Dismiss the splash screen when you get an ClientHandler::OnLoadingStateChange event with isloading == false.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Splash screen while app is loading

Postby Dare » Sat Jun 13, 2020 8:43 pm

HarmlessDave wrote:A full screen sized splash screen? Dismiss the splash screen when you get an ClientHandler::OnLoadingStateChange event with isloading == false.

Thank you for the help, I'll try using OnLoadingStateChange!
Definitely not a full screen sized one though. Actually rendering something simple (like a gradient and a logo) in the same window until loading is finished would also work. But I don't know if that's possible.
Dare
Techie
 
Posts: 14
Joined: Fri Mar 15, 2019 9:40 am

Re: Splash screen while app is loading

Postby HarmlessDave » Sun Jun 14, 2020 1:06 pm

Dare wrote:
HarmlessDave wrote:A full screen sized splash screen? Dismiss the splash screen when you get an ClientHandler::OnLoadingStateChange event with isloading == false.

Thank you for the help, I'll try using OnLoadingStateChange!
Definitely not a full screen sized one though. Actually rendering something simple (like a gradient and a logo) in the same window until loading is finished would also work. But I don't know if that's possible.


Unless you're using off-screen rendering I don't think you can use the same window, but others might know more.

Browsers paint and repaint their window as the page loads and then in response to script code, so it would be tricky to time doing your own painting even if you can temporarily hijack the OnPaint message. You can try it though, maybe with something like this?

    Have the parent window of the browser window intercept and normally pass along all repaint messages
    Wait until the window has the correct size, then set a flag telling the parent to keep the next paint message for itself
    Possibly invalidate the window to force a pain message
    Repaint the child and clear the flag saying to keep paint messages

Creating a separate splash screen window on top sounds easier and more reliable.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Splash screen while app is loading

Postby Peter » Mon Jun 15, 2020 9:44 am

You can override ClientHandler::OnLoadEnd(..., int httpStatusCode), so you'll know that the page was loaded successfully when this function is called with http code == 200.
Peter
Techie
 
Posts: 38
Joined: Thu Mar 05, 2020 9:41 am

Re: Splash screen while app is loading

Postby Dare » Tue Jun 16, 2020 11:01 am

HarmlessDave, Peter, thanks a lot for your help!
Dare
Techie
 
Posts: 14
Joined: Fri Mar 15, 2019 9:40 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 37 guests

cron