I use TChromiumWindow and create a browser using CreateBrowser method (and then load an HTML using LoadStringW method).
However, after upgrading to the latest release (was using 3.3282.1741 previously [February 25, 2018 commit]), when I create a browser, there are two visual glitches during creation. First the browser background is gray, then part of it is black and then it is rendered with content. In the previous version the background was always white and no gray/black areas were shown.
What could be changed that causes this? I see that TChromiumWindow has a Color properly, but it can't be changed (the change won't stick).
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.
Browser background
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Browser background
Please, check if any of the TChromiumWindow parents uses the "doublebuffer" property.
Some other users reported similar glitches when they used that property.
Make sure you set GlobalCEFApp.BackgroundColor in the DPR file too.
Some other users reported similar glitches when they used that property.
Make sure you set GlobalCEFApp.BackgroundColor in the DPR file too.
Re: Browser background
I have no DoubleBuffer property set anywhere.
The GlobalCEFApp.BackgroundColor helped though: if I set it to clWhite, the gray flicker no longer happens (interestingly, if I set it to clWindow, instead of gray, I get black).
The partial black flicker however remains. Even if I set a minimal html (for example <p>text</p>), there is a partial black flicker on the bottom of the chrome window on browser creation..
The GlobalCEFApp.BackgroundColor helped though: if I set it to clWhite, the gray flicker no longer happens (interestingly, if I set it to clWindow, instead of gray, I get black).
The partial black flicker however remains. Even if I set a minimal html (for example <p>text</p>), there is a partial black flicker on the bottom of the chrome window on browser creation..
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Browser background
That property has a TCefColor type. Use this code to set it to white :petko wrote: Thu Jun 07, 2018 8:37 pm I have no DoubleBuffer property set anywhere.
The GlobalCEFApp.BackgroundColor helped though: if I set it to clWhite, the gray flicker no longer happens (interestingly, if I set it to clWindow, instead of gray, I get black).
Code: Select all
GlobalCEFApp.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
This could be a Delphi redrawing issue. Do you see that flicker in the SimpleBrowser demo?petko wrote: Thu Jun 07, 2018 8:37 pm The partial black flicker however remains. Even if I set a minimal html (for example <p>text</p>), there is a partial black flicker on the bottom of the chrome window on browser creation..
Re: Browser background
Yes, probably its Delphi-drawing issue, because I create the browser in a frame. I suspect that the problem is somewhere in the frame initialization. I was just wondering what could've changed in Cef4Delphi, because it was working without this glitch in the previous versions.
SimpleBrowser does not have this issue
SimpleBrowser does not have this issue
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Browser background
I did a quick check in the recent commits since February and there is one change that might result in different behavior.
I had to modify TCEFWindowParent.GetChildWindowHandle to avoid some problems creating popup browsers with CEF3. Now it checks that the component's handle is allocated before trying to use it, which would create the handle automatically.
That function is used when the component receives WM_ERASEBKGND so it could have a different behavior erasing the background before the component's handle is created.
If you create the frame in runtime, try calling TChromiumWindow.CreateHandle after you create TChromiumWindow and you set TChromiumWindow.parent.
It's also possible that Chromium has changed the way it draws the web contents.
I had to modify TCEFWindowParent.GetChildWindowHandle to avoid some problems creating popup browsers with CEF3. Now it checks that the component's handle is allocated before trying to use it, which would create the handle automatically.
That function is used when the component receives WM_ERASEBKGND so it could have a different behavior erasing the background before the component's handle is created.
If you create the frame in runtime, try calling TChromiumWindow.CreateHandle after you create TChromiumWindow and you set TChromiumWindow.parent.
It's also possible that Chromium has changed the way it draws the web contents.
Re: Browser background
The CreateHandle trick doesn't work, but I've found some hack that makes thing bearable for now. Thanks!
-
- Posts: 1
- Joined: Wed Jul 15, 2020 12:01 pm
Re: Browser background
@petko
I encounter a similar problem with a frame created in runtime and I don't get it to draw.
You wrote "I've found some hack"
Could you share your it?
I encounter a similar problem with a frame created in runtime and I don't get it to draw.
You wrote "I've found some hack"
Could you share your it?