You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-11-23 21:34:53 +02:00
Fixed TChromium.OnPreKeyEvent and TChromium.OnKeyEvent event parameters in demos
Added a workaround for a focus issue in popup windows handled by CEF in the MiniBrowser demo.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// ************************************************************************
|
||||
// ************************************************************************
|
||||
// ***************************** CEF4Delphi *******************************
|
||||
// ************************************************************************
|
||||
//
|
||||
@@ -63,10 +63,10 @@ type
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure Chromium1PreKeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out isKeyboardShortcut, Result: Boolean);
|
||||
procedure Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject;
|
||||
@@ -212,7 +212,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
var
|
||||
TempMsg : TMsg;
|
||||
@@ -238,7 +238,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1PreKeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out isKeyboardShortcut, Result: Boolean);
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="823"/>
|
||||
<CursorPos X="60" Y="833"/>
|
||||
<TopLine Value="757"/>
|
||||
<CursorPos X="9" Y="780"/>
|
||||
<UsageCount Value="27"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -267,7 +267,7 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit33>
|
||||
</Units>
|
||||
<JumpHistory Count="5" HistoryIndex="4">
|
||||
<JumpHistory Count="15" HistoryIndex="14">
|
||||
<Position1>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="305" TopLine="293"/>
|
||||
@@ -288,6 +288,46 @@
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="232" Column="74" TopLine="213"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="835" Column="58" TopLine="823"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="222" Column="31" TopLine="209"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="782" Column="5" TopLine="754"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="775" Column="70" TopLine="757"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="222" Column="15" TopLine="137"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="692" Column="82" TopLine="690"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="179" Column="62" TopLine="178"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="862" Column="82" TopLine="860"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="176" Column="62" TopLine="175"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uMiniBrowser.pas"/>
|
||||
<Caret Line="886" Column="14" TopLine="860"/>
|
||||
</Position15>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -173,10 +173,10 @@ type
|
||||
procedure Chromium1FullScreenModeChange(Sender: TObject;
|
||||
const browser: ICefBrowser; fullscreen: Boolean);
|
||||
procedure Chromium1PreKeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out isKeyboardShortcut, Result: Boolean);
|
||||
procedure Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
procedure ApplicationEvents1Message(var Msg: tagMSG;
|
||||
var Handled: Boolean);
|
||||
@@ -689,7 +689,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
var
|
||||
TempMsg : TMsg;
|
||||
@@ -760,13 +760,25 @@ end;
|
||||
procedure TMiniBrowserFrm.Chromium1LoadEnd(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
httpStatusCode: Integer);
|
||||
var
|
||||
TempHandle : THandle;
|
||||
begin
|
||||
if (frame = nil) or not(frame.IsValid) then exit;
|
||||
if FClosing or (frame = nil) or not(frame.IsValid) or (browser = nil) then exit;
|
||||
|
||||
if frame.IsMain then
|
||||
StatusPnl.Caption := 'main frame loaded : ' + quotedstr(frame.name)
|
||||
if Chromium1.IsSameBrowser(browser) then
|
||||
begin
|
||||
if frame.IsMain then
|
||||
StatusPnl.Caption := 'main frame loaded : ' + quotedstr(frame.name)
|
||||
else
|
||||
StatusPnl.Caption := 'frame loaded : ' + quotedstr(frame.name);
|
||||
end
|
||||
else
|
||||
StatusPnl.Caption := 'frame loaded : ' + quotedstr(frame.name);
|
||||
begin
|
||||
// This is a workaround for a focus issue in popup windows handled by CEF
|
||||
TempHandle := Windows.GetWindow(Browser.Host.WindowHandle, GW_OWNER);
|
||||
if (TempHandle <> Handle) then
|
||||
Windows.SetFocus(TempHandle);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Chromium1LoadError(Sender: TObject;
|
||||
@@ -847,7 +859,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Chromium1PreKeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out isKeyboardShortcut, Result: Boolean);
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// ************************************************************************
|
||||
// ************************************************************************
|
||||
// ***************************** CEF4Delphi *******************************
|
||||
// ************************************************************************
|
||||
//
|
||||
@@ -69,10 +69,10 @@ type
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser;
|
||||
var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1PreKeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out isKeyboardShortcut, Result: Boolean);
|
||||
procedure Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
procedure Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
@@ -152,7 +152,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
var
|
||||
TempMsg : TMsg;
|
||||
@@ -206,7 +206,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1PreKeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out isKeyboardShortcut, Result: Boolean);
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
Reference in New Issue
Block a user