Page 1 of 1

About LoadEnd

Posted: Mon Jun 01, 2020 12:22 pm
by Alexeich
Hello.
The event TChromium.OnLoadEnd is running in not main thread. Why in MiniBrowse example are not used any synchronization working with form components?

Code: Select all

procedure TMiniBrowserFrm.Chromium1LoadEnd(Sender: TObject;
  const browser: ICefBrowser; const frame: ICefFrame;
  httpStatusCode: Integer);
begin
  if (frame = nil) or not(frame.IsValid) then exit;

  if frame.IsMain then
    StatusBar1.Panels[1].Text := 'main frame loaded : ' + quotedstr(frame.name)
   else
    StatusBar1.Panels[1].Text := 'frame loaded : ' + quotedstr(frame.name);
end;

Re: About LoadEnd

Posted: Tue Jun 02, 2020 7:18 am
by salvadordf
Hi,

You're right. All the VCL modifications in the demos should be done in the main application thread.
The only reason some of them do it inside CEF events is because I didn't want to complicate things even more.

It's highly recommended that all the VCL code should be executed in the main thread.

Re: About LoadEnd

Posted: Tue Jun 02, 2020 11:38 am
by Alexeich
salvadordf wrote: Tue Jun 02, 2020 7:18 am The only reason some of them do it inside CEF events is because I didn't want to complicate things even more.
Understood, thank you.