0

I'm use CEF 3.2623.1401.gb90a3be (Chromium 49.0.2623.110) in my project in Delphi 10.1. (I have to use a fairly old version of CEF/Chromium for backwards compatibility with WinXP). Take a look to this code:

procedure TMainFrom.IdHTTP_updateWork(ASender: TObject;
  AWorkMode: TWorkMode; AWorkCount: Int64);
  var download_percent:integer;
begin
  download_percent:=round(AWorkCount * 100 / update_file_size);
  Chromium1.browser.MainFrame.ExecuteJavaScript
  ('$(".progress").progress({percent: '+inttostr(download_percent)+'});',
  'about:blank', 0);
end;

The idea is to use JavaScript to show the progress of file download on the page loaded in Chromium. Everything works fine, but Chromium freezes while file is loaded, and only draws progress after the download is complete. Is there any analogue of Application.ProcessMessages for Chromium?

Red October
  • 689
  • 2
  • 12
  • 31
  • Even in normal Delphi programming outside of CEF, `Application.ProcessMessages` is still a horrible solution to any problem. It's a severe hack. If you feel the need to do such a thing, then there's a separate underlying problem which needs to be fixed instead. Perhaps the issue is in the JavaScript code itself? – Jerry Dodge Jul 07 '18 at 02:00
  • 2
    @JerryDodge Classic UI blockage. I would use `TIdHTTP` in a separate worker thread that posts messages to notify the UI thread to do what it needs to do while `TIdHTTP` continues to work in parallel. – Remy Lebeau Jul 07 '18 at 06:44

0 Answers0