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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

About LoadEnd

Post Reply
Alexeich
Posts: 24
Joined: Fri May 29, 2020 12:15 pm

About LoadEnd

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

Re: About LoadEnd

Post 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.
Alexeich
Posts: 24
Joined: Fri May 29, 2020 12:15 pm

Re: About LoadEnd

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