2017-09-23 11:38:29 +02:00
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
2019-10-19 10:58:34 +02:00
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
2017-09-23 11:38:29 +02:00
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
2019-01-08 19:15:25 +01:00
// Copyright <20> 2019 Salvador Diaz Fau. All rights reserved.
2017-09-23 11:38:29 +02:00
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
( *
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest < hgourvest@ gmail. com>
* Web site : http: //www.progdigy.com
* Repository : http: //code.google.com/p/delphichromiumembedded/
* Group : http: //groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
* )
unit uMainForm;
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
Winapi . Windows, Winapi . Messages, System. SysUtils, System. Variants, System. Classes, Vcl. Graphics,
2017-09-23 12:35:36 +02:00
Vcl. Controls, Vcl. Forms, Vcl. Dialogs, Vcl. ComCtrls, Vcl. Buttons, Vcl. ExtCtrls, Vcl. StdCtrls,
2017-09-23 11:38:29 +02:00
{$ELSE}
Windows, Messages, SysUtils, Variants, Classes, Graphics,
2017-09-23 12:35:36 +02:00
Controls, Forms, Dialogs, ComCtrls, Buttons, ExtCtrls, StdCtrls,
2017-09-23 11:38:29 +02:00
{$ENDIF}
2019-10-09 12:24:47 +02:00
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
uCEFConstants, uCEFSentinel;
2017-09-23 11:38:29 +02:00
const
CEFBROWSER_DESTROYWNDPARENT = WM_APP + $100 ;
CEFBROWSER_DESTROYTAB = WM_APP + $101 ;
2017-12-14 12:09:13 +01:00
CEFBROWSER_INITIALIZED = WM_APP + $102 ;
2018-03-31 18:08:18 +02:00
CEFBROWSER_CHECKTAGGEDTABS = WM_APP + $103 ;
2017-09-23 11:38:29 +02:00
type
2019-10-09 12:24:47 +02:00
{ TMainForm }
2017-09-23 11:38:29 +02:00
TMainForm = class( TForm)
2019-10-09 12:24:47 +02:00
CEFSentinel1: TCEFSentinel;
2017-09-23 11:38:29 +02:00
PageControl1: TPageControl;
ButtonPnl: TPanel;
NavButtonPnl: TPanel;
BackBtn: TButton;
ForwardBtn: TButton;
ReloadBtn: TButton;
StopBtn: TButton;
ConfigPnl: TPanel;
GoBtn: TButton;
URLEditPnl: TPanel;
URLCbx: TComboBox;
AddTabBtn: TButton;
RemoveTabBtn: TButton;
procedure AddTabBtnClick( Sender: TObject) ;
2019-10-09 12:24:47 +02:00
procedure CEFSentinel1Close( Sender: TObject) ;
2017-09-23 11:38:29 +02:00
procedure RemoveTabBtnClick( Sender: TObject) ;
procedure FormShow( Sender: TObject) ;
procedure PageControl1Change( Sender: TObject) ;
procedure FormCloseQuery( Sender: TObject; var CanClose: Boolean ) ;
procedure BackBtnClick( Sender: TObject) ;
procedure ForwardBtnClick( Sender: TObject) ;
procedure ReloadBtnClick( Sender: TObject) ;
procedure StopBtnClick( Sender: TObject) ;
procedure GoBtnClick( Sender: TObject) ;
2018-03-31 18:08:18 +02:00
procedure FormCreate( Sender: TObject) ;
2017-09-23 11:38:29 +02:00
protected
2018-03-31 18:08:18 +02:00
FClosingTab : boolean ;
FCanClose : boolean ;
FClosing : boolean ;
2017-09-23 11:38:29 +02:00
procedure Chromium_OnAfterCreated( Sender: TObject; const browser: ICefBrowser) ;
procedure Chromium_OnAddressChange( Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const url: ustring) ;
procedure Chromium_OnTitleChange( Sender: TObject; const browser: ICefBrowser; const title: ustring) ;
2019-03-28 10:40:36 +01:00
procedure Chromium_OnClose( Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction) ;
2017-09-23 11:38:29 +02:00
procedure Chromium_OnBeforeClose( Sender: TObject; const browser: ICefBrowser) ;
2019-06-16 10:31:13 +02:00
procedure Chromium_OnBeforePopup( Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean ; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean ; var Result : Boolean ) ;
2018-02-16 18:41:13 +01:00
2017-09-23 11:38:29 +02:00
procedure BrowserCreatedMsg( var aMessage : TMessage) ; message CEF_AFTERCREATED;
procedure BrowserDestroyWindowParentMsg( var aMessage : TMessage) ; message CEFBROWSER_DESTROYWNDPARENT;
procedure BrowserDestroyTabMsg( var aMessage : TMessage) ; message CEFBROWSER_DESTROYTAB;
2018-03-31 18:08:18 +02:00
procedure BrowserCheckTaggedTabsMsg( var aMessage : TMessage) ; message CEFBROWSER_CHECKTAGGEDTABS;
2017-12-14 12:09:13 +01:00
procedure CEFInitializedMsg( var aMessage : TMessage) ; message CEFBROWSER_INITIALIZED;
2017-09-23 11:38:29 +02:00
procedure WMMove( var aMessage : TWMMove) ; message WM_MOVE;
procedure WMMoving( var aMessage : TMessage) ; message WM_MOVING;
2017-12-18 19:38:56 +01:00
procedure WMEnterMenuLoop( var aMessage: TMessage) ; message WM_ENTERMENULOOP;
procedure WMExitMenuLoop( var aMessage: TMessage) ; message WM_EXITMENULOOP;
2017-09-23 11:38:29 +02:00
2018-03-31 18:08:18 +02:00
function AllTabSheetsAreTagged : boolean ;
procedure CloseAllBrowsers;
2017-09-23 11:38:29 +02:00
function GetPageIndex( const aSender : TObject; var aPageIndex : integer ) : boolean ;
procedure NotifyMoveOrResizeStarted;
function SearchChromium( aPageIndex : integer ; var aChromium : TChromium) : boolean ;
function SearchWindowParent( aPageIndex : integer ; var aWindowParent : TCEFWindowParent) : boolean ;
public
{ Public declarations }
end ;
var
MainForm: TMainForm;
2018-06-17 14:18:11 +02:00
procedure CreateGlobalCEFApp;
2017-12-14 12:09:13 +01:00
2017-09-23 11:38:29 +02:00
implementation
2019-05-19 16:08:15 +02:00
{$R *.lfm}
2017-09-23 11:38:29 +02:00
// This is just a simplified demo with tab handling.
// It's not meant to be a complete browser or the best way to implement a tabbed browser.
// In this demo all browsers share the buttons and URL combobox.
// All TChromium components share the same functions for their events sending the
// PageIndex of the Tab where they are included in the Message.lParam parameter if necessary.
// For simplicity the Button panel and the PageControl are disabled while adding or removing tab sheets.
2017-09-23 12:35:36 +02:00
// The Form can't be closed if it's destroying a tab.
2017-09-23 11:38:29 +02:00
2018-03-31 18:08:18 +02:00
// This is the destruction sequence when a user closes a tab sheet:
2017-09-23 11:38:29 +02:00
// 1. RemoveTabBtnClick calls TChromium.CloseBrowser of the selected tab which triggers a TChromium.OnClose event.
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROYWNDPARENT message to destroy TCEFWindowParent in the main thread which triggers a TChromium.OnBeforeClose event.
// 3. TChromium.OnBeforeClose sends a CEFBROWSER_DESTROYTAB message to destroy the tab in the main thread.
2018-03-31 18:08:18 +02:00
// This is the destruction sequence when the user closes the main form
// 1. FormCloseQuery hides the form and calls CloseAllBrowsers which calls TChromium.CloseBrowser in all tabs and triggers the TChromium.OnClose event.
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROYWNDPARENT message to destroy TCEFWindowParent in the main thread which triggers a TChromium.OnBeforeClose event.
2019-10-14 15:39:27 +02:00
// 3. TChromium.OnBeforeClose sends a CEFBROWSER_CHECKTAGGEDTABS message to set the TAG property to 1 in the TabSheet containing the TChromium.
// When all tabsheets have a TAG = 1 it calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
// 4. TCEFSentinel.OnClose sends WM_CLOSE to the form.
2018-03-31 18:08:18 +02:00
2017-12-14 12:09:13 +01:00
procedure GlobalCEFApp_OnContextInitialized;
begin
2017-12-27 14:05:33 +01:00
if ( MainForm < > nil ) and MainForm. HandleAllocated then
PostMessage( MainForm. Handle, CEFBROWSER_INITIALIZED, 0 , 0 ) ;
2017-12-14 12:09:13 +01:00
end ;
2018-06-17 14:18:11 +02:00
procedure CreateGlobalCEFApp;
begin
GlobalCEFApp : = TCefApplication. Create;
GlobalCEFApp. OnContextInitialized : = GlobalCEFApp_OnContextInitialized;
end ;
2017-09-23 11:38:29 +02:00
procedure TMainForm. AddTabBtnClick( Sender: TObject) ;
var
TempSheet : TTabSheet;
TempWindowParent : TCEFWindowParent;
TempChromium : TChromium;
begin
ButtonPnl. Enabled : = False ;
PageControl1. Enabled : = False ;
TempSheet : = TTabSheet. Create( PageControl1) ;
TempSheet. Caption : = 'New Tab' ;
TempSheet. PageControl : = PageControl1;
TempWindowParent : = TCEFWindowParent. Create( TempSheet) ;
TempWindowParent. Parent : = TempSheet;
TempWindowParent. Color : = clWhite;
TempWindowParent. Align : = alClient;
TempChromium : = TChromium. Create( TempSheet) ;
TempChromium. OnAfterCreated : = Chromium_OnAfterCreated;
TempChromium. OnAddressChange : = Chromium_OnAddressChange;
TempChromium. OnTitleChange : = Chromium_OnTitleChange;
TempChromium. OnClose : = Chromium_OnClose;
TempChromium. OnBeforeClose : = Chromium_OnBeforeClose;
2018-02-16 18:41:13 +01:00
TempChromium. OnBeforePopup : = Chromium_OnBeforePopup;
2017-09-23 11:38:29 +02:00
TempChromium. CreateBrowser( TempWindowParent, '' ) ;
end ;
2019-10-09 12:24:47 +02:00
procedure TMainForm. CEFSentinel1Close( Sender: TObject) ;
begin
FCanClose : = True ;
PostMessage( Handle, WM_CLOSE, 0 , 0 ) ;
end ;
2017-09-23 11:38:29 +02:00
procedure TMainForm. RemoveTabBtnClick( Sender: TObject) ;
var
TempChromium : TChromium;
begin
if SearchChromium( PageControl1. TabIndex, TempChromium) then
begin
2018-03-31 18:08:18 +02:00
FClosingTab : = True ;
2017-09-23 11:38:29 +02:00
ButtonPnl. Enabled : = False ;
PageControl1. Enabled : = False ;
TempChromium. CloseBrowser( True ) ;
end ;
end ;
procedure TMainForm. FormCloseQuery( Sender: TObject; var CanClose: Boolean ) ;
begin
2018-03-31 18:08:18 +02:00
if FClosingTab then
CanClose : = False
else
2019-01-29 10:16:58 +01:00
if ( PageControl1. PageCount = 0 ) then
CanClose : = True
else
begin
CanClose : = FCanClose;
if not( FClosing) then
begin
FClosing : = True ;
Visible : = False ;
CloseAllBrowsers;
end ;
end ;
2018-03-31 18:08:18 +02:00
end ;
procedure TMainForm. CloseAllBrowsers;
var
i, j, k : integer ;
TempComponent : TComponent;
TempSheet : TTabSheet;
TempCtnue : boolean ;
begin
k : = pred( PageControl1. PageCount) ;
while ( k > = 0 ) do
begin
TempSheet : = PageControl1. Pages[ k] ;
TempCtnue : = True ;
i : = 0 ;
j : = TempSheet. ComponentCount;
while ( i < j) and TempCtnue do
begin
TempComponent : = TempSheet. Components[ i] ;
if ( TempComponent < > nil ) and ( TempComponent is TChromium) then
begin
TChromium( TempComponent) . CloseBrowser( True ) ;
TempCtnue : = False ;
end
else
inc( i) ;
end ;
dec( k) ;
end ;
end ;
procedure TMainForm. FormCreate( Sender: TObject) ;
begin
FClosingTab : = False ;
FCanClose : = False ;
FClosing : = False ;
2017-09-23 11:38:29 +02:00
end ;
procedure TMainForm. FormShow( Sender: TObject) ;
begin
2017-12-14 12:09:13 +01:00
if ( GlobalCEFApp < > nil ) and
GlobalCEFApp. GlobalContextInitialized and
not( ButtonPnl. Enabled) then
begin
ButtonPnl. Enabled : = True ;
Caption : = 'Tab Browser' ;
cursor : = crDefault;
if ( PageControl1. PageCount = 0 ) then AddTabBtn. Click;
end ;
2017-09-23 11:38:29 +02:00
end ;
procedure TMainForm. ForwardBtnClick( Sender: TObject) ;
var
TempChromium : TChromium;
begin
if SearchChromium( PageControl1. TabIndex, TempChromium) then TempChromium. GoForward;
end ;
procedure TMainForm. GoBtnClick( Sender: TObject) ;
var
TempChromium : TChromium;
begin
if SearchChromium( PageControl1. TabIndex, TempChromium) then TempChromium. LoadURL( URLCbx. Text ) ;
end ;
procedure TMainForm. ReloadBtnClick( Sender: TObject) ;
var
TempChromium : TChromium;
begin
if SearchChromium( PageControl1. TabIndex, TempChromium) then TempChromium. Reload;
end ;
procedure TMainForm. BackBtnClick( Sender: TObject) ;
var
TempChromium : TChromium;
begin
if SearchChromium( PageControl1. TabIndex, TempChromium) then TempChromium. GoBack;
end ;
procedure TMainForm. StopBtnClick( Sender: TObject) ;
var
TempChromium : TChromium;
begin
if SearchChromium( PageControl1. TabIndex, TempChromium) then TempChromium. StopLoad;
end ;
procedure TMainForm. BrowserCreatedMsg( var aMessage : TMessage) ;
var
TempWindowParent : TCEFWindowParent;
TempChromium : TChromium;
begin
ButtonPnl. Enabled : = True ;
PageControl1. Enabled : = True ;
if SearchWindowParent( aMessage. lParam, TempWindowParent) then
TempWindowParent. UpdateSize;
if SearchChromium( aMessage. lParam, TempChromium) then
TempChromium. LoadURL( URLCbx. Items[ 0 ] ) ;
end ;
procedure TMainForm. BrowserDestroyWindowParentMsg( var aMessage : TMessage) ;
var
TempWindowParent : TCEFWindowParent;
begin
if SearchWindowParent( aMessage. lParam, TempWindowParent) then TempWindowParent. Free;
end ;
procedure TMainForm. BrowserDestroyTabMsg( var aMessage : TMessage) ;
begin
if ( aMessage. lParam > = 0 ) and
( aMessage. lParam < PageControl1. PageCount) then
PageControl1. Pages[ aMessage. lParam] . Free;
2018-03-31 18:08:18 +02:00
FClosingTab : = False ;
2017-09-23 11:38:29 +02:00
ButtonPnl. Enabled : = True ;
PageControl1. Enabled : = True ;
2018-03-31 18:08:18 +02:00
end ;
procedure TMainForm. BrowserCheckTaggedTabsMsg( var aMessage : TMessage) ;
begin
if ( aMessage. lParam > = 0 ) and
( aMessage. lParam < PageControl1. PageCount) then
begin
PageControl1. Pages[ aMessage. lParam] . Tag : = 1 ;
2019-10-09 12:24:47 +02:00
if AllTabSheetsAreTagged then CEFSentinel1. Start;
2018-03-31 18:08:18 +02:00
end ;
end ;
function TMainForm. AllTabSheetsAreTagged : boolean ;
var
i : integer ;
begin
Result : = True ;
i : = pred( PageControl1. PageCount) ;
while ( i > = 0 ) and Result do
if ( PageControl1. Pages[ i] . Tag < > 1 ) then
Result : = False
else
dec( i) ;
2017-09-23 11:38:29 +02:00
end ;
procedure TMainForm. Chromium_OnAfterCreated( Sender: TObject; const browser: ICefBrowser) ;
var
TempPageIndex : integer ;
begin
if GetPageIndex( Sender, TempPageIndex) then
PostMessage( Handle, CEF_AFTERCREATED, 0 , TempPageIndex) ;
end ;
procedure TMainForm. Chromium_OnAddressChange( Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const url: ustring) ;
var
TempPageIndex : integer ;
begin
2018-03-31 18:08:18 +02:00
if not( FClosing) and
( PageControl1. TabIndex > = 0 ) and
2017-09-23 11:38:29 +02:00
GetPageIndex( Sender, TempPageIndex) and
2017-09-23 12:35:36 +02:00
( PageControl1. TabIndex = TempPageIndex) then
2017-09-23 11:38:29 +02:00
URLCbx. Text : = url;
end ;
function TMainForm. GetPageIndex( const aSender : TObject; var aPageIndex : integer ) : boolean ;
begin
Result : = False ;
aPageIndex : = - 1 ;
if ( aSender < > nil ) and
( aSender is TComponent) and
( TComponent( aSender) . Owner < > nil ) and
( TComponent( aSender) . Owner is TTabSheet) then
begin
aPageIndex : = TTabSheet( TComponent( aSender) . Owner) . PageIndex;
Result : = True ;
end ;
end ;
procedure TMainForm. Chromium_OnTitleChange( Sender: TObject; const browser: ICefBrowser; const title: ustring) ;
var
TempPageIndex : integer ;
begin
2018-03-31 18:08:18 +02:00
if not( FClosing) and GetPageIndex( Sender, TempPageIndex) then
2017-09-23 11:38:29 +02:00
PageControl1. Pages[ TempPageIndex] . Caption : = title;
end ;
2019-03-28 10:40:36 +01:00
procedure TMainForm. Chromium_OnClose( Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction) ;
2017-09-23 11:38:29 +02:00
var
TempPageIndex : integer ;
begin
if GetPageIndex( Sender, TempPageIndex) then
PostMessage( Handle, CEFBROWSER_DESTROYWNDPARENT, 0 , TempPageIndex) ;
end ;
procedure TMainForm. Chromium_OnBeforeClose( Sender: TObject; const browser: ICefBrowser) ;
var
TempPageIndex : integer ;
begin
if GetPageIndex( Sender, TempPageIndex) then
2018-03-31 18:08:18 +02:00
begin
if FClosing then
PostMessage( Handle, CEFBROWSER_CHECKTAGGEDTABS, 0 , TempPageIndex)
else
PostMessage( Handle, CEFBROWSER_DESTROYTAB, 0 , TempPageIndex) ;
end ;
2017-09-23 11:38:29 +02:00
end ;
2018-02-16 18:41:13 +01:00
procedure TMainForm. Chromium_OnBeforePopup( Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
2018-03-29 20:02:04 +02:00
userGesture: Boolean ; const popupFeatures: TCefPopupFeatures;
2018-02-16 18:41:13 +01:00
var windowInfo: TCefWindowInfo; var client: ICefClient;
2019-06-16 10:31:13 +02:00
var settings: TCefBrowserSettings;
var extra_info: ICefDictionaryValue;
var noJavascriptAccess: Boolean ;
2018-03-29 20:02:04 +02:00
var Result : Boolean ) ;
2018-02-16 18:41:13 +01:00
begin
// For simplicity, this demo blocks all popup windows and new tabs
Result : = ( targetDisposition in [ WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW] ) ;
end ;
2017-09-23 11:38:29 +02:00
function TMainForm. SearchChromium( aPageIndex : integer ; var aChromium : TChromium) : boolean ;
var
i, j : integer ;
TempComponent : TComponent;
TempSheet : TTabSheet;
begin
Result : = False ;
aChromium : = nil ;
if ( aPageIndex > = 0 ) and ( aPageIndex < PageControl1. PageCount) then
begin
TempSheet : = PageControl1. Pages[ aPageIndex] ;
i : = 0 ;
j : = TempSheet. ComponentCount;
while ( i < j) and not( Result ) do
begin
TempComponent : = TempSheet. Components[ i] ;
if ( TempComponent < > nil ) and ( TempComponent is TChromium) then
begin
aChromium : = TChromium( TempComponent) ;
Result : = True ;
end
else
inc( i) ;
end ;
end ;
end ;
function TMainForm. SearchWindowParent( aPageIndex : integer ; var aWindowParent : TCEFWindowParent) : boolean ;
var
i, j : integer ;
TempControl : TControl;
TempSheet : TTabSheet;
begin
Result : = False ;
aWindowParent : = nil ;
if ( aPageIndex > = 0 ) and ( aPageIndex < PageControl1. PageCount) then
begin
TempSheet : = PageControl1. Pages[ aPageIndex] ;
i : = 0 ;
j : = TempSheet. ControlCount;
while ( i < j) and not( Result ) do
begin
TempControl : = TempSheet. Controls[ i] ;
if ( TempControl < > nil ) and ( TempControl is TCEFWindowParent) then
begin
aWindowParent : = TCEFWindowParent( TempControl) ;
Result : = True ;
end
else
inc( i) ;
end ;
end ;
end ;
procedure TMainForm. NotifyMoveOrResizeStarted;
var
i, j : integer ;
TempChromium : TChromium;
begin
2018-03-31 18:08:18 +02:00
if not( showing) or ( PageControl1 = nil ) or FClosing then exit;
2017-09-23 11:38:29 +02:00
i : = 0 ;
j : = PageControl1. PageCount;
while ( i < j) do
begin
if SearchChromium( i, TempChromium) then TempChromium. NotifyMoveOrResizeStarted;
inc( i) ;
end ;
end ;
procedure TMainForm. WMMove( var aMessage : TWMMove) ;
begin
inherited ;
NotifyMoveOrResizeStarted;
end ;
procedure TMainForm. WMMoving( var aMessage : TMessage) ;
begin
inherited ;
NotifyMoveOrResizeStarted;
end ;
2017-12-18 19:38:56 +01:00
procedure TMainForm. WMEnterMenuLoop( var aMessage: TMessage) ;
begin
inherited ;
2018-03-31 18:08:18 +02:00
if not( FClosing) and ( aMessage. wParam = 0 ) and ( GlobalCEFApp < > nil ) then
GlobalCEFApp. OsmodalLoop : = True ;
2017-12-18 19:38:56 +01:00
end ;
procedure TMainForm. WMExitMenuLoop( var aMessage: TMessage) ;
begin
inherited ;
2018-03-31 18:08:18 +02:00
if not( FClosing) and ( aMessage. wParam = 0 ) and ( GlobalCEFApp < > nil ) then
GlobalCEFApp. OsmodalLoop : = False ;
2017-12-18 19:38:56 +01:00
end ;
2017-09-23 11:38:29 +02:00
procedure TMainForm. PageControl1Change( Sender: TObject) ;
var
TempChromium : TChromium;
begin
if showing and SearchChromium( PageControl1. TabIndex, TempChromium) then
URLCbx. Text : = TempChromium. DocumentURL;
end ;
2017-12-14 12:09:13 +01:00
procedure TMainForm. CEFInitializedMsg( var aMessage : TMessage) ;
begin
if not( ButtonPnl. Enabled) then
begin
ButtonPnl. Enabled : = True ;
Caption : = 'Tab Browser' ;
cursor : = crDefault;
if ( PageControl1. PageCount = 0 ) then AddTabBtn. Click;
end ;
end ;
2017-09-23 11:38:29 +02:00
end .