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.
...
if event^.kind = KEYEVENT_RAWKEYDOWN then
begin
//Ctrl + Shift + L
if ((event^.modifiers and EVENTFLAG_CONTROL_DOWN) <> 0) and
((event^.modifiers and EVENTFLAG_SHIFT_DOWN) <> 0) and
(event^.windows_key_code = Ord('L')) then
begin
Result := True;
PanelEditVisibleChange; //Everything freezes when resizing — the only option is to kill the process.
end;
end;
...
procedure TWebForm.PanelEditVisibleChange;
var
vis: Boolean;
begin
CEFWindowParent.Visible := False;
Application.ProcessMessages;
//if Assigned(Chromium.Browser) then
// Chromium.Browser.Host.NotifyMoveOrResizeStarted;
vis := not(pnlEdit.Visible);
if vis then begin
//FOrigWidth := Self.Width;
Self.Width := FOrigWidth + pnlEdit.Width + spHaupt.Width;
pnlEdit.Visible := vis;
spHaupt.Visible := vis;
spHaupt.Left := pnlEdit.Left - spHaupt.Width - 10;
end
else
begin
spHaupt.Visible := vis;
pnlEdit.Visible := vis;
//FOrigWidth := Self.Width;
Self.Width := FOrigWidth;
end;
CEFWindowParent.Visible := True;
end;
[CEF4Delphi uses CEF 135.0.17 which includes Chromium 135.0.7049.52]
Most of the demos are configured to trigger the Chromium events in the context of a CEF thread which is different than the main application thread.
Save the information you may need in the TChromium event and use your preferred method to execute the code that updates the user interface in the main application thread. You can use TThread.Queue, a custom message to the main form, etc.
GlobalCEFApp.SingleProcess should only be used for debugging purposes. Read all the details in the code comments of that property and here : https://www.briskbard.com/index.php?lang=en&pageid=cef#debugging
Sending a custom message to the main form is one of the ways to fix this issue.
All Chromium and CEF events are executed in a CEF thread and sometimes in a different process.
The user interface is not thread safe and we must always handle it in the main application thread.
Read this document and the Wiki for more information :
https://www.briskbard.com/index.php?lang=en&pageid=cef
https://github.com/salvadordf/CEF4Delphi/wiki