1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Added TCEFSentinel component

- Added TCEFSentinel to MiniBrowser, TabbedBrowser, ToolBoxBrowser and SimpleBrowser2.
This commit is contained in:
Salvador Díaz Fau
2019-10-09 12:24:47 +02:00
parent 213162cef5
commit 096b2c9a4b
45 changed files with 852 additions and 279 deletions

View File

@@ -44,11 +44,12 @@ interface
uses
{$IFDEF DELPHI16_UP}
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
{$ELSE}
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls;
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
{$ENDIF}
uCEFSentinel;
const
CEFBROWSER_CREATED = WM_APP + $100;
@@ -61,9 +62,11 @@ type
ButtonPnl: TPanel;
Edit1: TEdit;
Button1: TButton;
CEFSentinel1: TCEFSentinel;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure CEFSentinel1Close(Sender: TObject);
private
// Variables to control when can we destroy the form safely
FCanClose : boolean; // Set to True when all the child forms are closed
@@ -206,11 +209,7 @@ end;
procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage);
begin
// If there are no more child forms we can destroy the main form
if FClosing and (ChildFormCount = 0) then
begin
FCanClose := True;
PostMessage(Handle, WM_CLOSE, 0, 0);
end;
if FClosing and (ChildFormCount = 0) then CEFSentinel1.Start;
end;
function TMainForm.CloseQuery: Boolean;
@@ -241,6 +240,12 @@ begin
cursor := crDefault;
end;
procedure TMainForm.CEFSentinel1Close(Sender: TObject);
begin
FCanClose := True;
PostMessage(Handle, WM_CLOSE, 0, 0);
end;
procedure TMainForm.FormShow(Sender: TObject);
begin
if (GlobalCEFApp <> nil) and GlobalCEFApp.GlobalContextInitialized then