Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Black WVWindowParent

Post Reply
RaelB
Posts: 26
Joined: Sun Feb 12, 2017 11:22 am

Black WVWindowParent

Post 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?
User avatar
salvadordf
Posts: 4304
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Black WVWindowParent

Post 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.
RaelB
Posts: 26
Joined: Sun Feb 12, 2017 11:22 am

Re: Black WVWindowParent

Post 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.
User avatar
salvadordf
Posts: 4304
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Black WVWindowParent

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