mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-15 15:55:56 +01: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
|
||||
ShowCaption = False
|
||||
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
|
||||
Left = 5
|
||||
Top = 5
|
||||
Width = 837
|
||||
Height = 20
|
||||
Align = alClient
|
||||
TabOrder = 1
|
||||
Width = 764
|
||||
Height = 21
|
||||
TabOrder = 0
|
||||
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
|
||||
object StatusBar1: TStatusBar
|
||||
|
@ -65,10 +65,12 @@ type
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
AddressBarPnl: TPanel;
|
||||
GoBtn: TButton;
|
||||
AddressEdt: TEdit;
|
||||
StatusBar1: TStatusBar;
|
||||
Timer1: TTimer;
|
||||
Panel1: TPanel;
|
||||
GoBtn: TButton;
|
||||
VisitDOMBtn: TButton;
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject;
|
||||
@ -84,6 +86,7 @@ type
|
||||
const browser: ICefBrowser; sourceProcess: TCefProcessId;
|
||||
const message: ICefProcessMessage; out Result: Boolean);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure VisitDOMBtnClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
protected
|
||||
@ -287,11 +290,15 @@ begin
|
||||
GoBtn.Click;
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.VisitDOMBtnClick(Sender: TObject);
|
||||
begin
|
||||
PostMessage(Handle, MINIBROWSER_VISITDOM, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.VisitDOMMsg(var aMessage : TMessage);
|
||||
var
|
||||
TempMsg : ICefProcessMessage;
|
||||
begin
|
||||
// Only works using a TCefCustomRenderProcessHandler.
|
||||
// Use the ArgumentList property if you need to pass some parameters.
|
||||
TempMsg := TCefProcessMessageRef.New(RETRIEVEDOM_MSGNAME); // Same name than TCefCustomRenderProcessHandler.MessageName
|
||||
Chromium1.SendProcessMessage(PID_RENDERER, TempMsg);
|
||||
|
Loading…
Reference in New Issue
Block a user