# Class TBrowserWindow

Description
Hierarchy
Methods
Properties

## Unit

uCEFBrowserWindow

## Declaration

`type TBrowserWindow = class(TCEFLinkedWinControlBase)`

## Description

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

## Hierarchy

- TWinControl
- TCEFWinControl
- TCEFLinkedWinControlBase
- TBrowserWindow

## Overview

### Methods

Protected | `function GetChromium: TChromium; override;`
Protected | `procedure DestroyHandle; override;`
Protected | `procedure RealizeBounds; override;`
Protected | `procedure DoEnter; override;`
Protected | `procedure DoExit; override;`
Protected | `procedure DoOnCreated;`
Protected | `procedure DoOnClosed(Data: PtrInt);`
Protected | `procedure DoOnFocus(Data: PtrInt);`
Public | `constructor Create(AOwner: TComponent); override;`
Public | `destructor Destroy; override;`
Public | `procedure CreateHandle; override;`
Public | `procedure CloseBrowser(aForceClose: boolean);`
Public | `procedure WaitForBrowserClosed;`
Public | `function IsClosed: boolean;`
Public | `procedure LoadURL(aURL: ustring);`

### Properties

Published | `property Chromium: TEmbeddedChromium read GetEmbeddedChromium;`
Published | `property OnBrowserCreated : TNotifyEvent read FOnBrowserCreated write FOnBrowserCreated;`
Published | `property OnBrowserClosed : TNotifyEvent read FOnBrowserClosed write FOnBrowserClosed;`

## Description

### Methods

Protected | `function GetChromium: TChromium; override;`
This item has no description.

Protected | `procedure DestroyHandle; override;`
This item has no description.

Protected | `procedure RealizeBounds; override;`
This item has no description.

Protected | `procedure DoEnter; override;`
This item has no description.

Protected | `procedure DoExit; override;`
This item has no description.

Protected | `procedure DoOnCreated;`
This item has no description.

Protected | `procedure DoOnClosed(Data: PtrInt);`
This item has no description.

Protected | `procedure DoOnFocus(Data: PtrInt);`
This item has no description.

Public | `constructor Create(AOwner: TComponent); override;`
This item has no description.

Public | `destructor Destroy; override;`
This item has no description.

Public | `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.

Public | `procedure CloseBrowser(aForceClose: boolean);`
This item has no description.

Public | `procedure WaitForBrowserClosed;`
This item has no description.

Public | `function IsClosed: boolean;`
This item has no description.

Public | `procedure LoadURL(aURL: ustring);`
This item has no description.

### Properties

Published | `property Chromium: TEmbeddedChromium read GetEmbeddedChromium;`
This item has no description.

Published | `property OnBrowserCreated : TNotifyEvent read FOnBrowserCreated write FOnBrowserCreated;`
This item has no description.

Published | `property OnBrowserClosed : TNotifyEvent read FOnBrowserClosed write FOnBrowserClosed;`
OnBrowserClosed will not be called, if the TBrowserWindow is destroyed/destroying before the browser is closed.

Generated by PasDoc 1.0.4.