Page 1 of 1
Its class
Posted: Wed Nov 14, 2018 11:11 am
by dilfich
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?
Re: Its class
Posted: Wed Nov 14, 2018 1:39 pm
by salvadordf
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;
Re: Its class
Posted: Wed Nov 14, 2018 7:08 pm
by dilfich
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?
Re: Its class
Posted: Wed Nov 14, 2018 8:19 pm
by salvadordf
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.
Re: Its class
Posted: Wed Nov 14, 2018 8:39 pm
by dilfich
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;
Re: Its class
Posted: Wed Nov 14, 2018 9:29 pm
by salvadordf
You need to add "override;" at the end of the declaration.