Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
dilfich
Posts: 368 Joined: Thu Nov 30, 2017 1:17 am
Post
by dilfich » Wed Nov 14, 2018 11:11 am
How to do it correctly...
Code: Select all
type
TChromModCEF = class(TChromium)
protected
procedure LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
constructor TChromModCEF.Create(AOwner: TComponent);
begin
Options.WebSecurity:= STATE_DISABLED;
OnLoadEnd:= LoadEnd;
inherited Create(AOwner);
end;
procedure TChromModCEF.LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
begin
//
end;
How to set your default options and initialize the procedure?
salvadordf
Posts: 4564 Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:
Post
by salvadordf » Wed Nov 14, 2018 1:39 pm
Hi,
You just need to override TChromium.AfterConstruction and TChromium.doOnLoadEnd like this :
Code: Select all
TChromModCEF = class(TChromium)
protected
procedure doOnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); override;
public
procedure AfterConstruction; override;
end;
procedure TChromModCEF.doOnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
begin
//
end;
procedure TChromModCEF.AfterConstruction;
begin
inherited AfterConstruction;
if (FOptions <> nil) then FOptions.WebSecurity := STATE_DISABLED;
end;
dilfich
Posts: 368 Joined: Thu Nov 30, 2017 1:17 am
Post
by dilfich » Wed Nov 14, 2018 7:08 pm
add
procedure doOnGetViewRect(const browser: ICefBrowser; var rect: TCefRect; out Result: Boolean); override;
error
E2037 Declaration of 'doOnGetViewRect' differs from previous declaration
And other treatments do not work, what's wrong?
salvadordf
Posts: 4564 Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:
Post
by salvadordf » Wed Nov 14, 2018 8:19 pm
Override using exactly the same parameters described in TChromium.
The doOnGetViewRect function has this declaration in the latest CEF4Delphi version :
Code: Select all
function doOnGetViewRect(const browser: ICefBrowser; var rect: TCefRect): Boolean;
Make sure you are overriding the TChromium class found in the latest CEF4Delphi. Other versions may have different parameters and Delphi will give the error message you mention if they don't have exactly the same parameters.
dilfich
Posts: 368 Joined: Thu Nov 30, 2017 1:17 am
Post
by dilfich » Wed Nov 14, 2018 8:39 pm
I've tried it before, but there's another message.
Code: Select all
function doOnGetViewRect(const browser: ICefBrowser; var rect: TCefRect): Boolean;
W1010 Method 'doOnGetViewRect' hides virtual method of base type 'TChromium'
uCEFChromium.pas
Code: Select all
function doOnGetViewRect(const browser: ICefBrowser; var rect: TCefRect): Boolean; virtual;
salvadordf
Posts: 4564 Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:
Post
by salvadordf » Wed Nov 14, 2018 9:29 pm
You need to add "override; " at the end of the declaration.