mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-04-17 06:57:13 +02:00
Added a 'Visit DOM' button to the DOMVisitor demo
This commit is contained in:
parent
bb1452d854
commit
374b48e45b
@ -39,26 +39,48 @@ object DOMVisitorFrm: TDOMVisitorFrm
|
|||||||
ParentDoubleBuffered = False
|
ParentDoubleBuffered = False
|
||||||
ShowCaption = False
|
ShowCaption = False
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object GoBtn: TButton
|
|
||||||
Left = 842
|
|
||||||
Top = 5
|
|
||||||
Width = 31
|
|
||||||
Height = 20
|
|
||||||
Margins.Left = 5
|
|
||||||
Align = alRight
|
|
||||||
Caption = 'Go'
|
|
||||||
TabOrder = 0
|
|
||||||
OnClick = GoBtnClick
|
|
||||||
end
|
|
||||||
object AddressEdt: TEdit
|
object AddressEdt: TEdit
|
||||||
Left = 5
|
Left = 5
|
||||||
Top = 5
|
Top = 5
|
||||||
Width = 837
|
Width = 764
|
||||||
Height = 20
|
Height = 21
|
||||||
Align = alClient
|
TabOrder = 0
|
||||||
TabOrder = 1
|
|
||||||
Text = 'https://www.google.com'
|
Text = 'https://www.google.com'
|
||||||
ExplicitHeight = 21
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 759
|
||||||
|
Top = 5
|
||||||
|
Width = 114
|
||||||
|
Height = 20
|
||||||
|
Align = alRight
|
||||||
|
BevelOuter = bvNone
|
||||||
|
Padding.Left = 5
|
||||||
|
ShowCaption = False
|
||||||
|
TabOrder = 1
|
||||||
|
object GoBtn: TButton
|
||||||
|
Left = 5
|
||||||
|
Top = 0
|
||||||
|
Width = 31
|
||||||
|
Height = 20
|
||||||
|
Margins.Left = 5
|
||||||
|
Align = alLeft
|
||||||
|
Caption = 'Go'
|
||||||
|
TabOrder = 0
|
||||||
|
OnClick = GoBtnClick
|
||||||
|
ExplicitLeft = 98
|
||||||
|
ExplicitTop = 5
|
||||||
|
end
|
||||||
|
object VisitDOMBtn: TButton
|
||||||
|
Left = 39
|
||||||
|
Top = 0
|
||||||
|
Width = 75
|
||||||
|
Height = 20
|
||||||
|
Align = alRight
|
||||||
|
Caption = 'Visit DOM'
|
||||||
|
TabOrder = 1
|
||||||
|
OnClick = VisitDOMBtnClick
|
||||||
|
ExplicitLeft = 42
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object StatusBar1: TStatusBar
|
object StatusBar1: TStatusBar
|
||||||
|
@ -65,10 +65,12 @@ type
|
|||||||
CEFWindowParent1: TCEFWindowParent;
|
CEFWindowParent1: TCEFWindowParent;
|
||||||
Chromium1: TChromium;
|
Chromium1: TChromium;
|
||||||
AddressBarPnl: TPanel;
|
AddressBarPnl: TPanel;
|
||||||
GoBtn: TButton;
|
|
||||||
AddressEdt: TEdit;
|
AddressEdt: TEdit;
|
||||||
StatusBar1: TStatusBar;
|
StatusBar1: TStatusBar;
|
||||||
Timer1: TTimer;
|
Timer1: TTimer;
|
||||||
|
Panel1: TPanel;
|
||||||
|
GoBtn: TButton;
|
||||||
|
VisitDOMBtn: TButton;
|
||||||
procedure GoBtnClick(Sender: TObject);
|
procedure GoBtnClick(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure Chromium1AfterCreated(Sender: TObject;
|
procedure Chromium1AfterCreated(Sender: TObject;
|
||||||
@ -84,6 +86,7 @@ type
|
|||||||
const browser: ICefBrowser; sourceProcess: TCefProcessId;
|
const browser: ICefBrowser; sourceProcess: TCefProcessId;
|
||||||
const message: ICefProcessMessage; out Result: Boolean);
|
const message: ICefProcessMessage; out Result: Boolean);
|
||||||
procedure Timer1Timer(Sender: TObject);
|
procedure Timer1Timer(Sender: TObject);
|
||||||
|
procedure VisitDOMBtnClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
{ Private declarations }
|
{ Private declarations }
|
||||||
protected
|
protected
|
||||||
@ -287,11 +290,15 @@ begin
|
|||||||
GoBtn.Click;
|
GoBtn.Click;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TDOMVisitorFrm.VisitDOMBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
PostMessage(Handle, MINIBROWSER_VISITDOM, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TDOMVisitorFrm.VisitDOMMsg(var aMessage : TMessage);
|
procedure TDOMVisitorFrm.VisitDOMMsg(var aMessage : TMessage);
|
||||||
var
|
var
|
||||||
TempMsg : ICefProcessMessage;
|
TempMsg : ICefProcessMessage;
|
||||||
begin
|
begin
|
||||||
// Only works using a TCefCustomRenderProcessHandler.
|
|
||||||
// Use the ArgumentList property if you need to pass some parameters.
|
// Use the ArgumentList property if you need to pass some parameters.
|
||||||
TempMsg := TCefProcessMessageRef.New(RETRIEVEDOM_MSGNAME); // Same name than TCefCustomRenderProcessHandler.MessageName
|
TempMsg := TCefProcessMessageRef.New(RETRIEVEDOM_MSGNAME); // Same name than TCefCustomRenderProcessHandler.MessageName
|
||||||
Chromium1.SendProcessMessage(PID_RENDERER, TempMsg);
|
Chromium1.SendProcessMessage(PID_RENDERER, TempMsg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user