type TBrowserWindow = class(TCEFLinkedWinControlBase)
TBrowserWindow
A simple "drop on the Form" component for an full embedded browser.
The component handles most events required by CEF. The only additions needed to be made by the User in their code are:
* Implement TForm.OnCloseQuery CEF must be able to destroy the browser, before the main form is closed. (That is while the Form still has a Handle, and the event loop is still running) It is adviced to do the same for any other form (other than the main form).
TForm.OnCloseQuery should call (for each TBrowserWindow) TBrowserWindow.CloseBrowser(True); The Form can be allowed to close by setting (checking for all BrowserWindows) CanClose := BrowserWindow.IsClosed;
On Windows and Linux it is also possible to Destroy the TBrowserWindow. This will wait for the browser to close, and after that the form can be closed. - However, this must be done in OnCloseQuery (or before). - Once TForm.Destroy is called, it is to late. By that time the event loop no longer runs.
*** IMPORTANT: (MacOS) *** On MacOs CloseBrowser() must be called, and the *event* must be awaited. Neither destroying the component, nor waiting with App.ProcessMessages will work. On MacOS, CEF will not finish until the OnCloseQuery event returned to the main event loop. (Hence ProcessMessage does not work). The same is true for any action taken in OnClick or other event. CEF always waits for any event to return to the main event loop. See also the BrowserWindowEX example how that affect modal forms.
* Implement TBrowserWindow.OnBrowserClosed If TForm.OnCloseQuery called CloseBrowser, this callback can be used to call Form.Close again (the callback should check if the browser was closed by OnCloseQuery.
* On Windows: handle the WM_ENTERMENULOOP and WM_EXITMENULOOP, as shown in examples
* Optional prevent pop-up windows by implementing Chromium.BeforePopup Chromium.OpenUrlFromTab
![]() |
function GetChromium: TChromium; override; |
![]() |
procedure DestroyHandle; override; |
![]() |
procedure RealizeBounds; override; |
![]() |
procedure DoEnter; override; |
![]() |
procedure DoExit; override; |
![]() |
procedure DoOnCreated; |
![]() |
procedure DoOnClosed(Data: PtrInt); |
![]() |
procedure DoOnFocus(Data: PtrInt); |
![]() |
constructor Create(AOwner: TComponent); override; |
![]() |
destructor Destroy; override; |
![]() |
procedure CreateHandle; override; |
![]() |
procedure CloseBrowser(aForceClose: boolean); |
![]() |
procedure WaitForBrowserClosed; |
![]() |
function IsClosed: boolean; |
![]() |
procedure LoadURL(aURL: ustring); |
![]() |
property Chromium: TEmbeddedChromium read GetEmbeddedChromium; |
![]() |
property OnBrowserCreated : TNotifyEvent read FOnBrowserCreated write FOnBrowserCreated; |
![]() |
property OnBrowserClosed : TNotifyEvent read FOnBrowserClosed write FOnBrowserClosed; |
![]() |
function GetChromium: TChromium; override; |
This item has no description. |
![]() |
procedure DestroyHandle; override; |
This item has no description. |
![]() |
procedure RealizeBounds; override; |
This item has no description. |
![]() |
procedure DoEnter; override; |
This item has no description. |
![]() |
procedure DoExit; override; |
This item has no description. |
![]() |
procedure DoOnCreated; |
This item has no description. |
![]() |
procedure DoOnClosed(Data: PtrInt); |
This item has no description. |
![]() |
procedure DoOnFocus(Data: PtrInt); |
This item has no description. |
![]() |
constructor Create(AOwner: TComponent); override; |
This item has no description. |
![]() |
destructor Destroy; override; |
This item has no description. |
![]() |
procedure CreateHandle; override; |
This item has no description. Showing description inherited from TCEFWinControl.CreateHandle. Exposes the CreateHandle procedure to create the Handle at any time. |
![]() |
procedure CloseBrowser(aForceClose: boolean); |
This item has no description. |
![]() |
procedure WaitForBrowserClosed; |
This item has no description. |
![]() |
function IsClosed: boolean; |
This item has no description. |
![]() |
procedure LoadURL(aURL: ustring); |
This item has no description. |
![]() |
property Chromium: TEmbeddedChromium read GetEmbeddedChromium; |
This item has no description. |
![]() |
property OnBrowserCreated : TNotifyEvent read FOnBrowserCreated write FOnBrowserCreated; |
This item has no description. |
![]() |
property OnBrowserClosed : TNotifyEvent read FOnBrowserClosed write FOnBrowserClosed; |
OnBrowserClosed will not be called, if the TBrowserWindow is destroyed/destroying before the browser is closed. |