You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-11-23 21:34:53 +02:00
Block F1 and F11 in MiniBrowser demos
This commit is contained in:
@@ -312,6 +312,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnResourceResponse = Chromium1ResourceResponse
|
OnResourceResponse = Chromium1ResourceResponse
|
||||||
OnFileDialog = Chromium1FileDialog
|
OnFileDialog = Chromium1FileDialog
|
||||||
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
||||||
|
OnChromeCommand = Chromium1ChromeCommand
|
||||||
OnRequestMediaAccessPermission = Chromium1RequestMediaAccessPermission
|
OnRequestMediaAccessPermission = Chromium1RequestMediaAccessPermission
|
||||||
Left = 32
|
Left = 32
|
||||||
Top = 224
|
Top = 224
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ type
|
|||||||
procedure Chromium1FileDialog(Sender: TObject; const browser: ICefBrowser; mode: TCefFileDialogMode; const title, defaultFilePath: ustring; const acceptFilters, accept_extensions, accept_descriptions: TStrings; const callback: ICefFileDialogCallback; var Result: Boolean);
|
procedure Chromium1FileDialog(Sender: TObject; const browser: ICefBrowser; mode: TCefFileDialogMode; const title, defaultFilePath: ustring; const acceptFilters, accept_extensions, accept_descriptions: TStrings; const callback: ICefFileDialogCallback; var Result: Boolean);
|
||||||
procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring);
|
procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring);
|
||||||
procedure Chromium1ResolvedHostAvailable(Sender: TObject; result: TCefErrorCode; const resolvedIps: TStrings);
|
procedure Chromium1ResolvedHostAvailable(Sender: TObject; result: TCefErrorCode; const resolvedIps: TStrings);
|
||||||
|
procedure Chromium1ChromeCommand(Sender: TObject; const browser: ICefBrowser; command_id: Integer; disposition: TCefWindowOpenDisposition; var aResult: Boolean);
|
||||||
|
|
||||||
procedure BackBtnClick(Sender: TObject);
|
procedure BackBtnClick(Sender: TObject);
|
||||||
procedure ForwardBtnClick(Sender: TObject);
|
procedure ForwardBtnClick(Sender: TObject);
|
||||||
@@ -553,6 +554,14 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1ChromeCommand(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; command_id: Integer;
|
||||||
|
disposition: TCefWindowOpenDisposition; var aResult: Boolean);
|
||||||
|
begin
|
||||||
|
aResult := (command_id = IDC_HELP_PAGE_VIA_KEYBOARD) or // Block the new Chromium window created when the user presses F1 for help.
|
||||||
|
(command_id = IDC_FULLSCREEN); // Block the "switch to full screen" command when the user presses F11.
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Chromium1ConsoleMessage(Sender: TObject;
|
procedure TMiniBrowserFrm.Chromium1ConsoleMessage(Sender: TObject;
|
||||||
const browser: ICefBrowser; level: TCefLogSeverity;
|
const browser: ICefBrowser; level: TCefLogSeverity;
|
||||||
const message_, source: ustring; line: Integer; out Result: Boolean);
|
const message_, source: ustring; line: Integer; out Result: Boolean);
|
||||||
|
|||||||
BIN
demos/Delphi_VCL/MiniBrowserD7/MiniBrowser.res
Normal file
BIN
demos/Delphi_VCL/MiniBrowserD7/MiniBrowser.res
Normal file
Binary file not shown.
@@ -264,6 +264,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnAfterCreated = Chromium1AfterCreated
|
OnAfterCreated = Chromium1AfterCreated
|
||||||
OnBeforeClose = Chromium1BeforeClose
|
OnBeforeClose = Chromium1BeforeClose
|
||||||
OnClose = Chromium1Close
|
OnClose = Chromium1Close
|
||||||
|
OnChromeCommand = Chromium1ChromeCommand
|
||||||
Left = 32
|
Left = 32
|
||||||
Top = 224
|
Top = 224
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ type
|
|||||||
procedure Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
|
procedure Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
|
||||||
procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring);
|
procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring);
|
||||||
procedure Chromium1StatusMessage(Sender: TObject; const browser: ICefBrowser; const value: ustring);
|
procedure Chromium1StatusMessage(Sender: TObject; const browser: ICefBrowser; const value: ustring);
|
||||||
procedure Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
|
procedure Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
|
||||||
|
procedure Chromium1ChromeCommand(Sender: TObject; const browser: ICefBrowser; command_id: Integer; disposition: TCefWindowOpenDisposition; var aResult: Boolean);
|
||||||
|
|
||||||
procedure BackBtnClick(Sender: TObject);
|
procedure BackBtnClick(Sender: TObject);
|
||||||
procedure ConfigBtnClick(Sender: TObject);
|
procedure ConfigBtnClick(Sender: TObject);
|
||||||
@@ -320,10 +321,7 @@ begin
|
|||||||
// if TChromium.MultiBrowserMode is enabled then we have to close all
|
// if TChromium.MultiBrowserMode is enabled then we have to close all
|
||||||
// stored browsers and not only the main browser.
|
// stored browsers and not only the main browser.
|
||||||
Chromium1.CloseAllBrowsers;
|
Chromium1.CloseAllBrowsers;
|
||||||
|
CEFWindowParent1.Free;
|
||||||
// Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled.
|
|
||||||
if GlobalCEFApp.ChromeRuntime then
|
|
||||||
CEFWindowParent1.Free;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -341,7 +339,6 @@ begin
|
|||||||
// used when you call any method or property in TChromium.
|
// used when you call any method or property in TChromium.
|
||||||
Chromium1.MultiBrowserMode := True;
|
Chromium1.MultiBrowserMode := True;
|
||||||
Chromium1.DefaultURL := MINIBROWSER_HOMEPAGE;
|
Chromium1.DefaultURL := MINIBROWSER_HOMEPAGE;
|
||||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.FormShow(Sender: TObject);
|
procedure TMiniBrowserFrm.FormShow(Sender: TObject);
|
||||||
@@ -412,4 +409,12 @@ begin
|
|||||||
GlobalCEFApp.OsmodalLoop := False;
|
GlobalCEFApp.OsmodalLoop := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1ChromeCommand(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; command_id: Integer;
|
||||||
|
disposition: TCefWindowOpenDisposition; var aResult: Boolean);
|
||||||
|
begin
|
||||||
|
aResult := (command_id = IDC_HELP_PAGE_VIA_KEYBOARD) or // Block the new Chromium window created when the user presses F1 for help.
|
||||||
|
(command_id = IDC_FULLSCREEN); // Block the "switch to full screen" command when the user presses F11.
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '3.4.0.0'
|
|
||||||
object NavControlPnl: TPanel
|
object NavControlPnl: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 25
|
Height = 25
|
||||||
@@ -250,6 +249,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnPrintJob = Chromium1PrintJob
|
OnPrintJob = Chromium1PrintJob
|
||||||
OnPrintReset = Chromium1PrintReset
|
OnPrintReset = Chromium1PrintReset
|
||||||
OnGetPDFPaperSize = Chromium1GetPDFPaperSize
|
OnGetPDFPaperSize = Chromium1GetPDFPaperSize
|
||||||
|
OnChromeCommand = Chromium1ChromeCommand
|
||||||
Left = 32
|
Left = 32
|
||||||
Top = 224
|
Top = 224
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ type
|
|||||||
OpenfilewithaDAT1: TMenuItem;
|
OpenfilewithaDAT1: TMenuItem;
|
||||||
|
|
||||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
procedure Chromium1ChromeCommand(Sender: TObject; const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition; var aResult: boolean);
|
||||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
procedure Chromium1GetPDFPaperSize(Sender: TObject; const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult: TCefSize);
|
procedure Chromium1GetPDFPaperSize(Sender: TObject; const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult: TCefSize);
|
||||||
@@ -620,6 +621,14 @@ begin
|
|||||||
SendCompMessage(CEF_AFTERCREATED);
|
SendCompMessage(CEF_AFTERCREATED);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1ChromeCommand(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; command_id: integer;
|
||||||
|
disposition: TCefWindowOpenDisposition; var aResult: boolean);
|
||||||
|
begin
|
||||||
|
aResult := (command_id = IDC_HELP_PAGE_VIA_KEYBOARD) or // Block the new Chromium window created when the user presses F1 for help.
|
||||||
|
(command_id = IDC_FULLSCREEN); // Block the "switch to full screen" command when the user presses F11.
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
procedure TMiniBrowserFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
begin
|
begin
|
||||||
// The main browser is being destroyed
|
// The main browser is being destroyed
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '3.4.0.0'
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Left = 1179
|
Left = 1179
|
||||||
Height = 663
|
Height = 663
|
||||||
@@ -117,11 +118,11 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object URLCbx: TComboBox
|
object URLCbx: TComboBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 22
|
Height = 21
|
||||||
Top = 3
|
Top = 3
|
||||||
Width = 978
|
Width = 978
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
ItemHeight = 14
|
ItemHeight = 13
|
||||||
ItemIndex = 0
|
ItemIndex = 0
|
||||||
Items.Strings = (
|
Items.Strings = (
|
||||||
'https://www.google.com'
|
'https://www.google.com'
|
||||||
@@ -274,6 +275,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnBeforeResourceLoad = Chromium1BeforeResourceLoad
|
OnBeforeResourceLoad = Chromium1BeforeResourceLoad
|
||||||
OnResourceResponse = Chromium1ResourceResponse
|
OnResourceResponse = Chromium1ResourceResponse
|
||||||
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
||||||
|
OnChromeCommand = Chromium1ChromeCommand
|
||||||
OnRequestMediaAccessPermission = Chromium1RequestMediaAccessPermission
|
OnRequestMediaAccessPermission = Chromium1RequestMediaAccessPermission
|
||||||
Left = 32
|
Left = 32
|
||||||
Top = 224
|
Top = 224
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ type
|
|||||||
N5: TMenuItem;
|
N5: TMenuItem;
|
||||||
Memoryinfo1: TMenuItem;
|
Memoryinfo1: TMenuItem;
|
||||||
|
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
@@ -186,6 +186,7 @@ type
|
|||||||
procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring);
|
procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring);
|
||||||
procedure Chromium1CertificateError(Sender: TObject; const browser: ICefBrowser; certError: Integer; const requestUrl: ustring; const sslInfo: ICefSslInfo; const callback: ICefCallback; out Result: Boolean);
|
procedure Chromium1CertificateError(Sender: TObject; const browser: ICefBrowser; certError: Integer; const requestUrl: ustring; const sslInfo: ICefSslInfo; const callback: ICefCallback; out Result: Boolean);
|
||||||
procedure Chromium1NavigationVisitorResultAvailable(Sender: TObject; const entry: ICefNavigationEntry; current: Boolean; index, total: Integer; var aResult: Boolean);
|
procedure Chromium1NavigationVisitorResultAvailable(Sender: TObject; const entry: ICefNavigationEntry; current: Boolean; index, total: Integer; var aResult: Boolean);
|
||||||
|
procedure Chromium1ChromeCommand(Sender: TObject; const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition; var aResult: boolean);
|
||||||
|
|
||||||
protected
|
protected
|
||||||
FResponse : TStringList;
|
FResponse : TStringList;
|
||||||
@@ -1142,6 +1143,14 @@ begin
|
|||||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1ChromeCommand(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; command_id: integer;
|
||||||
|
disposition: TCefWindowOpenDisposition; var aResult: boolean);
|
||||||
|
begin
|
||||||
|
aResult := (command_id = IDC_HELP_PAGE_VIA_KEYBOARD) or // Block the new Chromium window created when the user presses F1 for help.
|
||||||
|
(command_id = IDC_FULLSCREEN); // Block the "switch to full screen" command when the user presses F11.
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Chromium1CookiesFlushed(Sender: TObject);
|
procedure TMiniBrowserFrm.Chromium1CookiesFlushed(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
PostMessage(Handle, MINIBROWSER_COOKIESFLUSHED, 0, 0);
|
PostMessage(Handle, MINIBROWSER_COOKIESFLUSHED, 0, 0);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 653,
|
"InternalVersion" : 654,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "128.4.9"
|
"Version" : "128.4.9"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user