Page 1 of 1

Black WVWindowParent

Posted: Wed Jul 17, 2024 3:56 pm
by RaelB
Hi,

My app is similar to the tabbed browser demo, although it uses multiple nested TFrames. The WVBrowser and WVWindowParent are in one such child frame. When I create the browser it shows completely black:

Image

There are no errors, and OnAfterCreated event fires fine. When I try to load any url after this nothing happens. It looks like the "browser" has some how bombed out, although no error is reported.

If I use a Timer to create the browser (WVBrowser1.CreateBrowser), then it works fine and this problem does not occur. However, if timer is set to a low interval it will sometimes occur, e.g. if high CPU usage. I obviously want to set timer to lowest possible value.

Is there a way for me to check programmatically if such an error has occurred, e.g. some WVBrowser / WVWindowParent property/function to test if browser has bombed out?

Re: Black WVWindowParent

Posted: Thu Jul 18, 2024 1:48 pm
by salvadordf
If the TWVBrowserBase.OnAfterCreated event is triggered then WebView2 was able to create the browser successfully and TWVBrowserBase.Initialized is true.

The TWVBrowserBase.OnProcessFailed event will be triggered if some browser process failed.

Check that Edge works correctly on that web page in order to discard Edge issues or GPU driver issues.

The console in the DevTools might have some information.

Set the GlobalWebView2Loader.DebugLog and GlobalWebView2Loader.DebugLogLevel properties to get more information in the debug log.

Re: Black WVWindowParent

Posted: Thu Jul 18, 2024 9:03 pm
by RaelB
Yeah, it doesn't look like it's a problem with the browser. All events (that I've tested) are working fine, and no error events are being triggered. It looks like it is some problem in the VCL side of things.

In the SimpleBrowser demo, you have code that runs in the Form OnShow event. Why is it there and not in the Form OnCreate event? I moved it to the Form OnCreate event and it still works ok..

In my case, the WebView Frame is ultimately being called in the Form OnCreate event, and this problem is occurring. If I create the WebView Frame at a later point, I have not seen this problem occur.

Re: Black WVWindowParent

Posted: Fri Jul 19, 2024 8:41 am
by salvadordf
WebView2 used to have issues when an application tried to create a browser in a hidden parent.

Waiting for the OnShow event was the easiest fix for that issue.