You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-09-30 21:28:55 +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:
@@ -160,4 +160,9 @@ object Form1: TForm1
|
||||
Left = 24
|
||||
Top = 206
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
Left = 24
|
||||
Top = 350
|
||||
end
|
||||
end
|
||||
|
@@ -50,7 +50,8 @@ uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, SyncObjs,
|
||||
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel;
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
|
||||
uCEFSentinel;
|
||||
|
||||
const
|
||||
// Set this constant to True and load "file://transparency.html" to test a
|
||||
@@ -69,6 +70,7 @@ type
|
||||
SaveDialog1: TSaveDialog;
|
||||
Timer1: TTimer;
|
||||
Panel1: TBufferPanel;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
|
||||
procedure AppEventsMessage(var Msg: tagMSG; var Handled: Boolean);
|
||||
|
||||
@@ -113,6 +115,7 @@ type
|
||||
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure ComboBox1Enter(Sender: TObject);
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
|
||||
protected
|
||||
FPopUpBitmap : TBitmap;
|
||||
@@ -174,7 +177,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
|
||||
@@ -326,8 +330,7 @@ end;
|
||||
|
||||
procedure TForm1.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrBeforePopup(Sender : TObject;
|
||||
@@ -894,6 +897,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