You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-12 22:07:39 +02:00
Fixed the CustomResourceHandler demo
- Added TCEFSentinel to more demos
This commit is contained in:
@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="119"/>
|
||||
<CursorPos Y="140"/>
|
||||
<TopLine Value="227"/>
|
||||
<CursorPos X="21" Y="230"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -37,7 +37,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="3" HistoryIndex="2">
|
||||
<JumpHistory Count="8" HistoryIndex="7">
|
||||
<Position1>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
</Position1>
|
||||
@ -49,6 +49,26 @@
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="100" Column="11" TopLine="84"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="140" TopLine="119"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="145" TopLine="124"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="126" Column="82" TopLine="105"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="181" Column="39" TopLine="178"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="86" Column="15" TopLine="50"/>
|
||||
</Position8>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -69,4 +69,9 @@ object JSWindowBindingWithFunctionFrm: TJSWindowBindingWithFunctionFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 352
|
||||
end
|
||||
end
|
||||
|
@ -52,16 +52,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSWindowBindingWithFunctionFrm }
|
||||
|
||||
TJSWindowBindingWithFunctionFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -117,7 +122,8 @@ uses
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls 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 GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
var
|
||||
@ -169,6 +175,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
@ -215,8 +227,7 @@ end;
|
||||
procedure TJSWindowBindingWithFunctionFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.Chromium1Close(
|
||||
|
Reference in New Issue
Block a user