mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
Moved TChromium.InitializeDragAndDrop to TForm.OnShow in PopupBrowser
This commit is contained in:
parent
c455886d29
commit
1d8773c42c
@ -3,7 +3,9 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>The following button opens google.com in a popup window.</p>
|
<p>The following button opens google.com in a popup window.</p>
|
||||||
<button onclick="return popitup('https://www.google.com')">Click me</button>
|
<button onclick="return popitup('https://www.google.com')">Click me to open Google</button><br/><br/>
|
||||||
|
<button onclick="return popitup('about:blank')">Click me to open blank</button><br/><br/>
|
||||||
|
<button onclick="return popitup('file:///PopupBrowser.html')">Click me to open a file</button><br/><br/>
|
||||||
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
|
@ -50,7 +50,8 @@ uses
|
|||||||
Windows, Messages, SysUtils, Variants, Classes, SyncObjs,
|
Windows, Messages, SysUtils, Variants, Classes, SyncObjs,
|
||||||
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts,
|
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel;
|
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
|
||||||
|
uCEFChromiumCore;
|
||||||
|
|
||||||
const
|
const
|
||||||
CEF_SHOWCHILD = WM_APP + $A52;
|
CEF_SHOWCHILD = WM_APP + $A52;
|
||||||
@ -77,7 +78,7 @@ type
|
|||||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
|
||||||
procedure Chromium1Paint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer);
|
procedure Chromium1Paint(Sender: TObject; const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer);
|
||||||
procedure Chromium1CursorChange(Sender: TObject; const browser: ICefBrowser; cursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo);
|
procedure Chromium1CursorChange(Sender: TObject; const browser: ICefBrowser; cursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo);
|
||||||
procedure Chromium1GetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect);
|
procedure Chromium1GetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect);
|
||||||
procedure Chromium1GetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean);
|
procedure Chromium1GetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean);
|
||||||
@ -306,8 +307,6 @@ function TChildForm.CreateClientHandler(var windowInfo : TCefWindowInfo;
|
|||||||
const targetFrameName : string;
|
const targetFrameName : string;
|
||||||
const popupFeatures : TCefPopupFeatures) : boolean;
|
const popupFeatures : TCefPopupFeatures) : boolean;
|
||||||
begin
|
begin
|
||||||
Chromium1.InitializeDragAndDrop(Panel1);
|
|
||||||
|
|
||||||
WindowInfoAsWindowless(windowInfo, 0, targetFrameName);
|
WindowInfoAsWindowless(windowInfo, 0, targetFrameName);
|
||||||
FPopupFeatures := popupFeatures;
|
FPopupFeatures := popupFeatures;
|
||||||
FClientInitialized := Chromium1.CreateClientHandler(client);
|
FClientInitialized := Chromium1.CreateClientHandler(client);
|
||||||
@ -428,7 +427,7 @@ end;
|
|||||||
|
|
||||||
procedure TChildForm.Chromium1Paint( Sender : TObject;
|
procedure TChildForm.Chromium1Paint( Sender : TObject;
|
||||||
const browser : ICefBrowser;
|
const browser : ICefBrowser;
|
||||||
kind : TCefPaintElementType;
|
type_ : TCefPaintElementType;
|
||||||
dirtyRectsCount : NativeUInt;
|
dirtyRectsCount : NativeUInt;
|
||||||
const dirtyRects : PCefRectArray;
|
const dirtyRects : PCefRectArray;
|
||||||
const buffer : Pointer;
|
const buffer : Pointer;
|
||||||
@ -448,7 +447,7 @@ begin
|
|||||||
|
|
||||||
if Panel1.BeginBufferDraw then
|
if Panel1.BeginBufferDraw then
|
||||||
begin
|
begin
|
||||||
if (kind = PET_POPUP) then
|
if (type_ = PET_POPUP) then
|
||||||
begin
|
begin
|
||||||
if (FPopUpBitmap = nil) or
|
if (FPopUpBitmap = nil) or
|
||||||
(width <> FPopUpBitmap.Width) or
|
(width <> FPopUpBitmap.Width) or
|
||||||
@ -523,7 +522,7 @@ begin
|
|||||||
Panel1.EndBufferDraw;
|
Panel1.EndBufferDraw;
|
||||||
Panel1.InvalidatePanel;
|
Panel1.InvalidatePanel;
|
||||||
|
|
||||||
if (kind = PET_VIEW) then
|
if (type_ = PET_VIEW) then
|
||||||
begin
|
begin
|
||||||
if TempForcedResize or FPendingResize then PostMessage(Handle, CEF_PENDINGRESIZE, 0, 0);
|
if TempForcedResize or FPendingResize then PostMessage(Handle, CEF_PENDINGRESIZE, 0, 0);
|
||||||
|
|
||||||
@ -547,7 +546,7 @@ begin
|
|||||||
FShowPopUp := False;
|
FShowPopUp := False;
|
||||||
FPopUpRect := rect(0, 0, 0, 0);
|
FPopUpRect := rect(0, 0, 0, 0);
|
||||||
|
|
||||||
if (Chromium1 <> nil) then Chromium1.Invalidate(PET_VIEW);
|
Chromium1.Invalidate(PET_VIEW);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -566,12 +565,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
|
procedure TChildForm.Chromium1TitleChange( Sender : TObject;
|
||||||
|
const browser : ICefBrowser;
|
||||||
|
const title : ustring);
|
||||||
begin
|
begin
|
||||||
Caption := title;
|
Caption := title;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean);
|
procedure TChildForm.Chromium1Tooltip( Sender : TObject;
|
||||||
|
const browser : ICefBrowser;
|
||||||
|
var text : ustring;
|
||||||
|
out Result : Boolean);
|
||||||
begin
|
begin
|
||||||
Panel1.hint := text;
|
Panel1.hint := text;
|
||||||
Panel1.ShowHint := (length(text) > 0);
|
Panel1.ShowHint := (length(text) > 0);
|
||||||
@ -603,28 +607,28 @@ procedure TChildForm.WMMove(var aMessage : TWMMove);
|
|||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted;
|
Chromium1.NotifyMoveOrResizeStarted;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.WMMoving(var aMessage : TMessage);
|
procedure TChildForm.WMMoving(var aMessage : TMessage);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted;
|
Chromium1.NotifyMoveOrResizeStarted;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.WMCaptureChanged(var aMessage : TMessage);
|
procedure TChildForm.WMCaptureChanged(var aMessage : TMessage);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if (Chromium1 <> nil) then Chromium1.SendCaptureLostEvent;
|
Chromium1.SendCaptureLostEvent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.WMCancelMode(var aMessage : TMessage);
|
procedure TChildForm.WMCancelMode(var aMessage : TMessage);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if (Chromium1 <> nil) then Chromium1.SendCaptureLostEvent;
|
Chromium1.SendCaptureLostEvent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.WMEnterMenuLoop(var aMessage: TMessage);
|
procedure TChildForm.WMEnterMenuLoop(var aMessage: TMessage);
|
||||||
@ -642,13 +646,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, NewDPI: Integer);
|
procedure TChildForm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, NewDPI: Integer);
|
||||||
begin
|
|
||||||
if (Chromium1 <> nil) then
|
|
||||||
begin
|
begin
|
||||||
Chromium1.NotifyScreenInfoChanged;
|
Chromium1.NotifyScreenInfoChanged;
|
||||||
Chromium1.WasResized;
|
Chromium1.WasResized;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TChildForm.FormClose(Sender: TObject; var Action: TCloseAction);
|
procedure TChildForm.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||||
begin
|
begin
|
||||||
@ -663,7 +664,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
FClosing := True;
|
FClosing := True;
|
||||||
Visible := False;
|
Visible := False;
|
||||||
Chromium1.CloseBrowser(True);
|
|
||||||
|
if Chromium1.Initialized then
|
||||||
|
Chromium1.CloseBrowser(True)
|
||||||
|
else
|
||||||
|
CanClose := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -700,6 +705,7 @@ end;
|
|||||||
|
|
||||||
procedure TChildForm.FormShow(Sender: TObject);
|
procedure TChildForm.FormShow(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
Chromium1.InitializeDragAndDrop(Panel1);
|
||||||
Chromium1.WasHidden(False);
|
Chromium1.WasHidden(False);
|
||||||
Chromium1.SendFocusEvent(True);
|
Chromium1.SendFocusEvent(True);
|
||||||
end;
|
end;
|
||||||
@ -714,7 +720,7 @@ var
|
|||||||
TempEvent : TCefMouseEvent;
|
TempEvent : TCefMouseEvent;
|
||||||
TempTime : integer;
|
TempTime : integer;
|
||||||
begin
|
begin
|
||||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
if (GlobalCEFApp <> nil) then
|
||||||
begin
|
begin
|
||||||
Panel1.SetFocus;
|
Panel1.SetFocus;
|
||||||
|
|
||||||
@ -744,7 +750,7 @@ var
|
|||||||
TempPoint : TPoint;
|
TempPoint : TPoint;
|
||||||
TempTime : integer;
|
TempTime : integer;
|
||||||
begin
|
begin
|
||||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
if (GlobalCEFApp <> nil) then
|
||||||
begin
|
begin
|
||||||
GetCursorPos(TempPoint);
|
GetCursorPos(TempPoint);
|
||||||
TempPoint := Panel1.ScreenToclient(TempPoint);
|
TempPoint := Panel1.ScreenToclient(TempPoint);
|
||||||
@ -764,7 +770,7 @@ var
|
|||||||
TempEvent : TCefMouseEvent;
|
TempEvent : TCefMouseEvent;
|
||||||
TempTime : integer;
|
TempTime : integer;
|
||||||
begin
|
begin
|
||||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
if (GlobalCEFApp <> nil) then
|
||||||
begin
|
begin
|
||||||
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
|
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
|
||||||
|
|
||||||
@ -780,7 +786,7 @@ procedure TChildForm.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift:
|
|||||||
var
|
var
|
||||||
TempEvent : TCefMouseEvent;
|
TempEvent : TCefMouseEvent;
|
||||||
begin
|
begin
|
||||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
if (GlobalCEFApp <> nil) then
|
||||||
begin
|
begin
|
||||||
TempEvent.x := X;
|
TempEvent.x := X;
|
||||||
TempEvent.y := Y;
|
TempEvent.y := Y;
|
||||||
|
@ -154,6 +154,13 @@ begin
|
|||||||
GlobalCEFApp.EnableHighDPISupport := True;
|
GlobalCEFApp.EnableHighDPISupport := True;
|
||||||
//GlobalCEFApp.LogFile := 'debug.log';
|
//GlobalCEFApp.LogFile := 'debug.log';
|
||||||
//GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
//GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||||
|
{
|
||||||
|
GlobalCEFApp.FrameworkDirPath := 'c:\cef';
|
||||||
|
GlobalCEFApp.ResourcesDirPath := 'c:\cef';
|
||||||
|
GlobalCEFApp.LocalesDirPath := 'c:\cef\locales';
|
||||||
|
GlobalCEFApp.cache := 'c:\cef\cache';
|
||||||
|
GlobalCEFApp.UserDataPath := 'c:\cef\User Data';
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
@ -342,11 +349,7 @@ begin
|
|||||||
FCriticalSection.Acquire;
|
FCriticalSection.Acquire;
|
||||||
|
|
||||||
if (FChildForm <> nil) then
|
if (FChildForm <> nil) then
|
||||||
begin
|
|
||||||
//FChildForm.ApplyPopupFeatures;
|
|
||||||
//FChildForm.Show;
|
|
||||||
PostMessage(FChildForm.Handle, CEF_SHOWCHILD, 0, 0);
|
PostMessage(FChildForm.Handle, CEF_SHOWCHILD, 0, 0);
|
||||||
end;
|
|
||||||
|
|
||||||
FChildForm := TChildForm.Create(self);
|
FChildForm := TChildForm.Create(self);
|
||||||
finally
|
finally
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<BuildModes Active="Default"/>
|
<BuildModes Active="Default"/>
|
||||||
<Units Count="8">
|
<Units Count="9">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="MiniBrowser.lpr"/>
|
<Filename Value="MiniBrowser.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<TopLine Value="46"/>
|
<TopLine Value="46"/>
|
||||||
<CursorPos Y="54"/>
|
<CursorPos Y="54"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||||
</Unit0>
|
</Unit0>
|
||||||
@ -20,11 +20,10 @@
|
|||||||
<ComponentName Value="MiniBrowserFrm"/>
|
<ComponentName Value="MiniBrowserFrm"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<IsVisibleTab Value="True"/>
|
|
||||||
<EditorIndex Value="1"/>
|
<EditorIndex Value="1"/>
|
||||||
<TopLine Value="735"/>
|
<TopLine Value="735"/>
|
||||||
<CursorPos X="43" Y="749"/>
|
<CursorPos X="43" Y="749"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Bookmarks Count="3">
|
<Bookmarks Count="3">
|
||||||
<Item0 Y="806" ID="1"/>
|
<Item0 Y="806" ID="1"/>
|
||||||
<Item1 X="49" Y="61" ID="2"/>
|
<Item1 X="49" Y="61" ID="2"/>
|
||||||
@ -40,10 +39,10 @@
|
|||||||
<ComponentName Value="PreferencesFrm"/>
|
<ComponentName Value="PreferencesFrm"/>
|
||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<EditorIndex Value="2"/>
|
<EditorIndex Value="3"/>
|
||||||
<TopLine Value="69"/>
|
<TopLine Value="69"/>
|
||||||
<CursorPos X="86" Y="70"/>
|
<CursorPos X="86" Y="70"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<Loaded Value="True"/>
|
<Loaded Value="True"/>
|
||||||
<LoadedDesigner Value="True"/>
|
<LoadedDesigner Value="True"/>
|
||||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||||
@ -55,7 +54,7 @@
|
|||||||
<HasResources Value="True"/>
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<EditorIndex Value="-1"/>
|
<EditorIndex Value="-1"/>
|
||||||
<UsageCount Value="20"/>
|
<UsageCount Value="21"/>
|
||||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
<Unit4>
|
<Unit4>
|
||||||
@ -86,6 +85,15 @@
|
|||||||
<TopLine Value="43"/>
|
<TopLine Value="43"/>
|
||||||
<UsageCount Value="10"/>
|
<UsageCount Value="10"/>
|
||||||
</Unit7>
|
</Unit7>
|
||||||
|
<Unit8>
|
||||||
|
<Filename Value="..\..\..\source\uCEFTypes.pas"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
|
<EditorIndex Value="2"/>
|
||||||
|
<TopLine Value="280"/>
|
||||||
|
<CursorPos X="51" Y="290"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit8>
|
||||||
</Units>
|
</Units>
|
||||||
<JumpHistory Count="30" HistoryIndex="29">
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
<Position1>
|
<Position1>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 68,
|
"InternalVersion" : 69,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "78.3.4.0"
|
"Version" : "78.3.4.0"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user