Answer the question
In order to leave comments, you need to log in
How to assign a procedure to a dynamically created TChromium object in Delphi?
Hail the Lord! I'm trying to figure out why the OnBeforePopup procedure for a dynamically created Tchromium object is not assigned Compile
error:
[dcc32 Error] Unit6.pas(117): E2009 Incompatible types: 'method pointer and regular procedure' procedure
code
procedure OnBeforePopup(Sender: TObject; const browser: ICefBrowser;
const frame: ICefFrame; const targetUrl, targetFrameName: ustring;
targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean;
var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
var client: ICefClient; var settings: TCefBrowserSettings;
var noJavascriptAccess: Boolean; out Result: Boolean);
var
web: TChromium;
begin
// prevent popup
web.Load(targetUrl);
Result := True;
end;
procedure TForm6.ChromeTabs1ButtonAddClick(Sender: TObject;
var Handled: Boolean);
var
T: TTabSheet;
web: TChromium;
begin
PageControl1.ActivePageIndex := ChromeTabs1.ActiveTabIndex;
T := TTabSheet.Create(self);
T.PageControl := PageControl1;
T.Caption := 'General';
PageControl1.ActivePage := T;
// t.TabVisible:=false;
web := TChromium.Create(T);
web := TChromium.Create(self);
web.OnBeforePopup := OnBeforePopup;
TWinControl(web).Name := 'NewWebBrowser' + inttostr(random(999666111));
TWinControl(web).Parent := T;
web.Align := alClient;
web.Load('ya.ru');
web.OnBeforePopup := OnBeforePopup;
end;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question