You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-08-04 21:32:54 +02:00
Added TCEFSentinel to more demos
- Check that all frames are valid before using them - Added an error page to MiniBrowser.
This commit is contained in:
@ -80,4 +80,9 @@ object Form1: TForm1
|
||||
Left = 24
|
||||
Top = 206
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
Left = 24
|
||||
Top = 280
|
||||
end
|
||||
end
|
||||
|
@ -50,7 +50,8 @@ uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, SyncObjs,
|
||||
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts, Keyboard,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel;
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
|
||||
uCEFSentinel;
|
||||
|
||||
const
|
||||
HOMEPAGE_URL = 'https://www.google.com';
|
||||
@ -72,9 +73,11 @@ type
|
||||
Timer1: TTimer;
|
||||
Panel1: TBufferPanel;
|
||||
TouchKeyboard1: TTouchKeyboard;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
|
||||
procedure AppEventsMessage(var Msg: tagMSG; var Handled: Boolean);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
|
||||
procedure Panel1Enter(Sender: TObject);
|
||||
procedure Panel1Exit(Sender: TObject);
|
||||
@ -167,7 +170,8 @@ uses
|
||||
// 2- chrmosr.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
|
||||
// set "Result" to false and CEF3 will destroy the internal browser immediately.
|
||||
// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed.
|
||||
// Now we set FCanClose to True and send WM_CLOSE to the form.
|
||||
// Now we call TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4- TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -299,8 +303,7 @@ end;
|
||||
|
||||
procedure TForm1.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrBeforeContextMenu( Sender : TObject;
|
||||
@ -861,6 +864,12 @@ begin
|
||||
(cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime);
|
||||
end;
|
||||
|
||||
procedure TForm1.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(True);
|
||||
|
Reference in New Issue
Block a user