1

My TWebBrowser flickers when its parent resizes.

I tried some of the things mentioned HERE such as DoubleBuffering, disabling FullRepaint, adding those WMEnterSizeMove and WMExitSizeMove procedures but nothing was worked yet.

EDIT: Also, I tried ControlStyle := ControlStyle + [csOpaque]; and

procedure T<<yourclassorform>>.StopFlicker(var Msg: TWMEraseBkgnd);
begin
  Msg.Result := 1;
end;

How do I minimize or stop the flickering?

Community
  • 1
  • 1
Dian
  • 1,187
  • 3
  • 18
  • 35
  • I'd guess there's a tab sheet hosting the browser. Change the WindowProc for the tab sheet so it that doesn't respond to WM_ERASEBACKGROUND. That often sorts out flickering. – David Heffernan Jun 30 '11 at 08:28
  • 1
    .... And creates some new update glitches, for controls without their own window proc. For an IE control which is a completely independant window handle with its own window proc that you don't control, it has no effect. – Warren P Jun 30 '11 at 10:52
  • @Warren I'm supposing the flickering is the tab sheet painting its background before that background being overwritten by the opaque web browser window. Consider a web browser control parented by a tab sheet with alClient. There's absolutely no point painting the background of the tab sheet. The only possible outcome of that is flicker. – David Heffernan Jun 30 '11 at 11:40
  • It should also be possible to parent the IE control (TWebBrowser) directly on the form, then, and avoid having the panel and its window handle even around then? – Warren P Jun 30 '11 at 12:29

1 Answers1

3

I had the same kind of problem with flickering and I found out that it was the javaScript on the page causing the flickering. The javascript was calling some methods that were taking a long time, and thus the page was flickering.

In the end, reworking the content of the html page (it was a locally generated bit of HTML generated in the delphi app) only got so far. I investigated replacing TWebBrowser first with TEmbeddedWB from www.bsalsa.com, and eventually gave up on the embedded Internet Explorer completely, and have decided from here forward to only use the "Chrome Embedded Framework" and its delphi wrapper, which basically means you're using WebKit instead of IE.

Warren P
  • 65,725
  • 40
  • 181
  • 316
  • Having used Chromium - haven't you application distribution became 23MB bigger? – Gad D Lord Nov 22 '11 at 05:07
  • Yes, it does get bigger, but then, you can run on computers that have a really old and busted version of IE installed too. I'd rather have 23 mb more to distribute, and an app that works on all my customer's PCs. – Warren P Nov 22 '11 at 13:57