mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-04-17 06:57:13 +02:00
Fix for duplicated resources in FMX apps made by SchneiderInfosystems
- The FMX demos now load the initial web page using the TFMXChromium.DefaultUrl property. - Added the $(FrameworkType) conditional define to all the FMX demos. - Added the $(FrameworkType) conditional define to the CEF4Delphi_FMX project.
This commit is contained in:
parent
00cb710e59
commit
2ed976d906
@ -72,6 +72,7 @@
|
|||||||
<SanitizedProjectName>FMXExternalPumpBrowser</SanitizedProjectName>
|
<SanitizedProjectName>FMXExternalPumpBrowser</SanitizedProjectName>
|
||||||
<VerInfo_Locale>3082</VerInfo_Locale>
|
<VerInfo_Locale>3082</VerInfo_Locale>
|
||||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
<DCC_Define>$(FrameworkType);$(DCC_Define)</DCC_Define>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
<DCC_UsePackage>DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;vclFireDAC;FireDACDb2Driver;DataSnapFireDAC;svnui;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;Componentes_UI;vcldb;bindcompfmx;svn;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;CEF4Delphi;DbxCommonDriver;IndyProtocols240;IndySystem240;fmx;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;bindcompvcl;DataSnapConnectors;VCLRESTComponents;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;DataSnapClient;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
<DCC_UsePackage>DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;vclFireDAC;FireDACDb2Driver;DataSnapFireDAC;svnui;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;Componentes_UI;vcldb;bindcompfmx;svn;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;CEF4Delphi;DbxCommonDriver;IndyProtocols240;IndySystem240;fmx;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;bindcompvcl;DataSnapConnectors;VCLRESTComponents;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;DataSnapClient;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
@ -107,6 +108,7 @@
|
|||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
|
<AppDPIAwarenessMode>PerMonitor</AppDPIAwarenessMode>
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
|
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
@ -155,9 +157,10 @@
|
|||||||
<Source Name="MainSource">FMXExternalPumpBrowser.dpr</Source>
|
<Source Name="MainSource">FMXExternalPumpBrowser.dpr</Source>
|
||||||
</Source>
|
</Source>
|
||||||
<Excluded_Packages>
|
<Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl250.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl260.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\DataExplorerDBXPluginEnt260.bpl">DBExpress Enterprise Data Explorer Integration</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k260.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="$(BDSBIN)\dclofficexp260.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
</Excluded_Packages>
|
</Excluded_Packages>
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<Deployment Version="3">
|
<Deployment Version="3">
|
||||||
|
@ -157,6 +157,11 @@ var
|
|||||||
// It was necessary to destroy the browser following the destruction sequence described in
|
// It was necessary to destroy the browser following the destruction sequence described in
|
||||||
// the MDIBrowser demo but in OSR mode there are some modifications.
|
// the MDIBrowser demo but in OSR mode there are some modifications.
|
||||||
|
|
||||||
|
// All FMX applications using CEF4Delphi should add the $(FrameworkType) conditional define
|
||||||
|
// in the project options to avoid duplicated resources.
|
||||||
|
// This demo has that define in the menu option :
|
||||||
|
// Project -> Options -> Building -> Delphi compiler -> Conditional defines (All configurations)
|
||||||
|
|
||||||
// This is the destruction sequence in OSR mode :
|
// This is the destruction sequence in OSR mode :
|
||||||
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls chrmosr.CloseBrowser(True).
|
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls chrmosr.CloseBrowser(True).
|
||||||
// 2- chrmosr.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
|
// 2- chrmosr.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
|
||||||
@ -252,6 +257,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// opaque white background color
|
// opaque white background color
|
||||||
chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||||
|
chrmosr.DefaultUrl := AddressEdt.Text;
|
||||||
|
|
||||||
if chrmosr.CreateBrowser then
|
if chrmosr.CreateBrowser then
|
||||||
DoBrowserCreated
|
DoBrowserCreated
|
||||||
@ -857,7 +863,6 @@ begin
|
|||||||
Caption := 'FMX External Pump Browser';
|
Caption := 'FMX External Pump Browser';
|
||||||
AddressPnl.Enabled := True;
|
AddressPnl.Enabled := True;
|
||||||
Panel1.SetFocus;
|
Panel1.SetFocus;
|
||||||
LoadURL;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFMXExternalPumpBrowserFrm.getModifiers(Shift: TShiftState): TCefEventFlags;
|
function TFMXExternalPumpBrowserFrm.getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
<SanitizedProjectName>FMXToolBoxBrowser</SanitizedProjectName>
|
<SanitizedProjectName>FMXToolBoxBrowser</SanitizedProjectName>
|
||||||
<VerInfo_Locale>3082</VerInfo_Locale>
|
<VerInfo_Locale>3082</VerInfo_Locale>
|
||||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
<DCC_Define>$(FrameworkType);$(DCC_Define)</DCC_Define>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
<DCC_UsePackage>DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;DataSnapFireDAC;svnui;tethering;Componentes;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;Componentes_Int;IndyProtocols240;fmx;fmxdae;FireDACDBXDriver;dbexpress;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;CEF4Delphi_FMX;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;vcl;DBXSybaseASEDriver;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;Componentes_UI;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;Componentes_Misc;IndySystem240;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;Componentes_RTF;DBXInformixDriver;bindcompvcl;Componentes_vCard;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
|
<DCC_UsePackage>DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;DataSnapFireDAC;svnui;tethering;Componentes;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;Componentes_Int;IndyProtocols240;fmx;fmxdae;FireDACDBXDriver;dbexpress;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;CEF4Delphi_FMX;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;vcl;DBXSybaseASEDriver;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;Componentes_UI;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;Componentes_Misc;IndySystem240;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;Componentes_RTF;DBXInformixDriver;bindcompvcl;Componentes_vCard;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
@ -162,9 +163,10 @@
|
|||||||
<Source Name="MainSource">FMXToolBoxBrowser.dpr</Source>
|
<Source Name="MainSource">FMXToolBoxBrowser.dpr</Source>
|
||||||
</Source>
|
</Source>
|
||||||
<Excluded_Packages>
|
<Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl250.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl260.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\DataExplorerDBXPluginEnt260.bpl">DBExpress Enterprise Data Explorer Integration</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k260.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="$(BDSBIN)\dclofficexp260.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
</Excluded_Packages>
|
</Excluded_Packages>
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<Deployment Version="3">
|
<Deployment Version="3">
|
||||||
|
@ -19,7 +19,6 @@ object ChildForm: TChildForm
|
|||||||
DesignerMasterStyle = 0
|
DesignerMasterStyle = 0
|
||||||
object FMXChromium1: TFMXChromium
|
object FMXChromium1: TFMXChromium
|
||||||
OnBeforePopup = FMXChromium1BeforePopup
|
OnBeforePopup = FMXChromium1BeforePopup
|
||||||
OnAfterCreated = FMXChromium1AfterCreated
|
|
||||||
OnBeforeClose = FMXChromium1BeforeClose
|
OnBeforeClose = FMXChromium1BeforeClose
|
||||||
OnClose = FMXChromium1Close
|
OnClose = FMXChromium1Close
|
||||||
Left = 40
|
Left = 40
|
||||||
|
@ -59,7 +59,6 @@ type
|
|||||||
procedure FormDestroy(Sender: TObject);
|
procedure FormDestroy(Sender: TObject);
|
||||||
|
|
||||||
procedure FMXChromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess, Result: Boolean);
|
procedure FMXChromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess, Result: Boolean);
|
||||||
procedure FMXChromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
|
||||||
procedure FMXChromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
procedure FMXChromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
procedure FMXChromium1Close(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
procedure FMXChromium1Close(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||||
|
|
||||||
@ -78,7 +77,6 @@ type
|
|||||||
|
|
||||||
public
|
public
|
||||||
procedure NotifyMoveOrResizeStarted;
|
procedure NotifyMoveOrResizeStarted;
|
||||||
procedure DoBrowserCreated;
|
|
||||||
procedure DoDestroyParent;
|
procedure DoDestroyParent;
|
||||||
procedure SendCloseMsg;
|
procedure SendCloseMsg;
|
||||||
|
|
||||||
@ -141,12 +139,6 @@ begin
|
|||||||
FMXWindowParent.SetBounds(0, 0, ClientWidth - 1, ClientHeight - 1);
|
FMXWindowParent.SetBounds(0, 0, ClientWidth - 1, ClientHeight - 1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.FMXChromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
|
||||||
begin
|
|
||||||
// Now the browser is fully initialized we can send a message to the main form to load the initial web page.
|
|
||||||
PostCustomMessage(CEF_AFTERCREATED, 0, BrowserID);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TChildForm.FMXChromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
procedure TChildForm.FMXChromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
begin
|
begin
|
||||||
FCanClose := True;
|
FCanClose := True;
|
||||||
@ -230,6 +222,7 @@ begin
|
|||||||
TempRect.Right := round(TempClientRect.Right);
|
TempRect.Right := round(TempClientRect.Right);
|
||||||
TempRect.Bottom := round(TempClientRect.Bottom);
|
TempRect.Bottom := round(TempClientRect.Bottom);
|
||||||
|
|
||||||
|
FMXChromium1.DefaultUrl := FHomepage;
|
||||||
FMXChromium1.CreateBrowser(TempHandle, TempRect);
|
FMXChromium1.CreateBrowser(TempHandle, TempRect);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -240,12 +233,6 @@ begin
|
|||||||
if (FMXChromium1 <> nil) then FMXChromium1.NotifyMoveOrResizeStarted;
|
if (FMXChromium1 <> nil) then FMXChromium1.NotifyMoveOrResizeStarted;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChildForm.DoBrowserCreated;
|
|
||||||
begin
|
|
||||||
// Load the homepage after the browser is fully initialized
|
|
||||||
if (length(FHomepage) > 0) then FMXChromium1.LoadURL(FHomepage);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TChildForm.DoDestroyParent;
|
procedure TChildForm.DoDestroyParent;
|
||||||
begin
|
begin
|
||||||
// We destroy FMXWindowParent safely in the main thread and this will trigger the TFMXChromium.OnBeforeClose event.
|
// We destroy FMXWindowParent safely in the main thread and this will trigger the TFMXChromium.OnBeforeClose event.
|
||||||
|
@ -189,22 +189,6 @@ begin
|
|||||||
(Application.MainForm is TMainForm) then
|
(Application.MainForm is TMainForm) then
|
||||||
TMainForm(Application.MainForm).DoChildDestroyed;
|
TMainForm(Application.MainForm).DoChildDestroyed;
|
||||||
|
|
||||||
CEF_AFTERCREATED :
|
|
||||||
if not(Application.Terminated) then
|
|
||||||
begin
|
|
||||||
i := 0;
|
|
||||||
|
|
||||||
while (i < screen.FormCount) do
|
|
||||||
if (screen.Forms[i] is TChildForm) and
|
|
||||||
(TChildForm(screen.Forms[i]).BrowserID = TempMsg.lParam) then
|
|
||||||
begin
|
|
||||||
TChildForm(screen.Forms[i]).DoBrowserCreated;
|
|
||||||
i := screen.FormCount;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
inc(i);
|
|
||||||
end;
|
|
||||||
|
|
||||||
CEF_DESTROY :
|
CEF_DESTROY :
|
||||||
if not(Application.Terminated) then
|
if not(Application.Terminated) then
|
||||||
begin
|
begin
|
||||||
|
@ -99,6 +99,25 @@ uses
|
|||||||
FMX.Platform, FMX.Platform.Win,
|
FMX.Platform, FMX.Platform.Win,
|
||||||
uCEFMiscFunctions, uFMXApplicationService, uChildForm, uCEFApplication;
|
uCEFMiscFunctions, uFMXApplicationService, uChildForm, uCEFApplication;
|
||||||
|
|
||||||
|
// This Firemonkey demo shows how to create child windows with browsers using CEF4Delphi.
|
||||||
|
// It uses a custom IFMXApplicationService to handle Windows messages.
|
||||||
|
|
||||||
|
// The application must not try to create browsers before GlobalCEFApp.GlobalContextInitialized
|
||||||
|
// is TRUE, which is set in a different thread when the GlobalCEFApp.OnContextInitialized
|
||||||
|
// event is triggered.
|
||||||
|
// There are several ways to handle the race between the form creation and the
|
||||||
|
// GlobalCEFApp.OnContextInitialized event but this demo is using a simple check
|
||||||
|
// in the TForm.OnShow event.
|
||||||
|
|
||||||
|
// All FMX applications using CEF4Delphi should add the $(FrameworkType) conditional define
|
||||||
|
// in the project options to avoid duplicated resources.
|
||||||
|
// This demo has that define in the menu option :
|
||||||
|
// Project -> Options -> Building -> Delphi compiler -> Conditional defines (All configurations)
|
||||||
|
|
||||||
|
// It's very important to close all the browsers before closing the main form.
|
||||||
|
// Always follow these destruction steps in your applications to avoid
|
||||||
|
// crashes when it's closed. Read the code comments in uChildForm.pas
|
||||||
|
|
||||||
// Main form destruction steps
|
// Main form destruction steps
|
||||||
// ===========================
|
// ===========================
|
||||||
// 1. Destroy all child forms
|
// 1. Destroy all child forms
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
<SanitizedProjectName>SimpleFMXBrowser</SanitizedProjectName>
|
<SanitizedProjectName>SimpleFMXBrowser</SanitizedProjectName>
|
||||||
<VerInfo_Locale>3082</VerInfo_Locale>
|
<VerInfo_Locale>3082</VerInfo_Locale>
|
||||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
<DCC_Define>$(FrameworkType);$(DCC_Define)</DCC_Define>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
<DCC_UsePackage>DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;vclFireDAC;FireDACDb2Driver;DataSnapFireDAC;svnui;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;IndyProtocols240;IndySystem240;fmx;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;bindcompvcl;DataSnapConnectors;VCLRESTComponents;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;CEF4Delphi_FMX;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;DataSnapClient;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
<DCC_UsePackage>DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;vclFireDAC;FireDACDb2Driver;DataSnapFireDAC;svnui;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;IndyProtocols240;IndySystem240;fmx;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;bindcompvcl;DataSnapConnectors;VCLRESTComponents;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;CEF4Delphi_FMX;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;DataSnapClient;DataSnapServerMidas;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
@ -158,9 +159,10 @@
|
|||||||
<Source Name="MainSource">SimpleFMXBrowser.dpr</Source>
|
<Source Name="MainSource">SimpleFMXBrowser.dpr</Source>
|
||||||
</Source>
|
</Source>
|
||||||
<Excluded_Packages>
|
<Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl250.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl260.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\DataExplorerDBXPluginEnt260.bpl">DBExpress Enterprise Data Explorer Integration</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k260.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
|
<Excluded_Packages Name="$(BDSBIN)\dclofficexp260.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
</Excluded_Packages>
|
</Excluded_Packages>
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<Deployment Version="3">
|
<Deployment Version="3">
|
||||||
|
@ -62,8 +62,6 @@ type
|
|||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure Timer1Timer(Sender: TObject);
|
procedure Timer1Timer(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure FMXChromium1AfterCreated(Sender: TObject;
|
|
||||||
const browser: ICefBrowser);
|
|
||||||
procedure FMXChromium1Close(Sender: TObject;
|
procedure FMXChromium1Close(Sender: TObject;
|
||||||
const browser: ICefBrowser; out Result: Boolean);
|
const browser: ICefBrowser; out Result: Boolean);
|
||||||
procedure FMXChromium1BeforeClose(Sender: TObject;
|
procedure FMXChromium1BeforeClose(Sender: TObject;
|
||||||
@ -77,6 +75,8 @@ type
|
|||||||
var settings: TCefBrowserSettings; var noJavascriptAccess,
|
var settings: TCefBrowserSettings; var noJavascriptAccess,
|
||||||
Result: Boolean);
|
Result: Boolean);
|
||||||
procedure FormResize(Sender: TObject);
|
procedure FormResize(Sender: TObject);
|
||||||
|
procedure FMXChromium1AfterCreated(Sender: TObject;
|
||||||
|
const browser: ICefBrowser);
|
||||||
|
|
||||||
protected
|
protected
|
||||||
// Variables to control when can we destroy the form safely
|
// Variables to control when can we destroy the form safely
|
||||||
@ -118,6 +118,11 @@ implementation
|
|||||||
// This demo uses a TFMXChromium and a TFMXWindowParent.
|
// This demo uses a TFMXChromium and a TFMXWindowParent.
|
||||||
// TFMXApplicationService is used to handle custom Windows messages
|
// TFMXApplicationService is used to handle custom Windows messages
|
||||||
|
|
||||||
|
// All FMX applications using CEF4Delphi should add the $(FrameworkType) conditional define
|
||||||
|
// in the project options to avoid duplicated resources.
|
||||||
|
// This demo has that define in the menu option :
|
||||||
|
// Project -> Options -> Building -> Delphi compiler -> Conditional defines (All configurations)
|
||||||
|
|
||||||
// Destruction steps
|
// Destruction steps
|
||||||
// =================
|
// =================
|
||||||
// 1. FormCloseQuery sets CanClose to FALSE calls TFMXChromium.CloseBrowser which triggers the TFMXChromium.OnClose event.
|
// 1. FormCloseQuery sets CanClose to FALSE calls TFMXChromium.CloseBrowser which triggers the TFMXChromium.OnClose event.
|
||||||
@ -128,7 +133,8 @@ uses
|
|||||||
FMX.Platform, FMX.Platform.Win,
|
FMX.Platform, FMX.Platform.Win,
|
||||||
uCEFMiscFunctions, uCEFApplication, uFMXApplicationService;
|
uCEFMiscFunctions, uCEFApplication, uFMXApplicationService;
|
||||||
|
|
||||||
procedure TSimpleFMXBrowserFrm.FMXChromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
procedure TSimpleFMXBrowserFrm.FMXChromium1AfterCreated(Sender: TObject;
|
||||||
|
const browser: ICefBrowser);
|
||||||
begin
|
begin
|
||||||
// Now the browser is fully initialized we can send a message to the main form to load the initial web page.
|
// Now the browser is fully initialized we can send a message to the main form to load the initial web page.
|
||||||
PostCustomMessage(CEF_AFTERCREATED);
|
PostCustomMessage(CEF_AFTERCREATED);
|
||||||
@ -247,6 +253,7 @@ begin
|
|||||||
TempRect.Right := round(TempClientRect.Right);
|
TempRect.Right := round(TempClientRect.Right);
|
||||||
TempRect.Bottom := round(TempClientRect.Bottom);
|
TempRect.Bottom := round(TempClientRect.Bottom);
|
||||||
|
|
||||||
|
FMXChromium1.DefaultUrl := AddressEdt.Text;
|
||||||
if not(FMXChromium1.CreateBrowser(TempHandle, TempRect)) then Timer1.Enabled := True;
|
if not(FMXChromium1.CreateBrowser(TempHandle, TempRect)) then Timer1.Enabled := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -284,7 +291,6 @@ begin
|
|||||||
// Now the browser is fully initialized
|
// Now the browser is fully initialized
|
||||||
Caption := 'Simple FMX Browser';
|
Caption := 'Simple FMX Browser';
|
||||||
AddressPnl.Enabled := True;
|
AddressPnl.Enabled := True;
|
||||||
LoadURL;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSimpleFMXBrowserFrm.DoDestroyParent;
|
procedure TSimpleFMXBrowserFrm.DoDestroyParent;
|
||||||
|
@ -24,6 +24,7 @@ package CEF4Delphi_FMX;
|
|||||||
{$MINENUMSIZE 1}
|
{$MINENUMSIZE 1}
|
||||||
{$IMAGEBASE $400000}
|
{$IMAGEBASE $400000}
|
||||||
{$DEFINE RELEASE}
|
{$DEFINE RELEASE}
|
||||||
|
{$DEFINE $(FrameworkType)}
|
||||||
{$ENDIF IMPLICITBUILDING}
|
{$ENDIF IMPLICITBUILDING}
|
||||||
{$IMPLICITBUILD OFF}
|
{$IMPLICITBUILD OFF}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<ProjectVersion>18.5</ProjectVersion>
|
<ProjectVersion>18.5</ProjectVersion>
|
||||||
<FrameworkType>VCL</FrameworkType>
|
<FrameworkType>VCL</FrameworkType>
|
||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
<Config Condition="'$(Config)'==''">Release</Config>
|
||||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
<TargetedPlatforms>3</TargetedPlatforms>
|
<TargetedPlatforms>3</TargetedPlatforms>
|
||||||
<AppType>Package</AppType>
|
<AppType>Package</AppType>
|
||||||
@ -34,6 +34,12 @@
|
|||||||
<Cfg_1>true</Cfg_1>
|
<Cfg_1>true</Cfg_1>
|
||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''">
|
||||||
|
<Cfg_1_Win64>true</Cfg_1_Win64>
|
||||||
|
<CfgParent>Cfg_1</CfgParent>
|
||||||
|
<Cfg_1>true</Cfg_1>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||||
<Cfg_2>true</Cfg_2>
|
<Cfg_2>true</Cfg_2>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
@ -75,6 +81,10 @@
|
|||||||
<DCC_S>false</DCC_S>
|
<DCC_S>false</DCC_S>
|
||||||
<DCC_F>false</DCC_F>
|
<DCC_F>false</DCC_F>
|
||||||
<DCC_K>false</DCC_K>
|
<DCC_K>false</DCC_K>
|
||||||
|
<DCC_Define>$(FrameworkType);$(DCC_Define)</DCC_Define>
|
||||||
|
<VerInfo_Locale>3082</VerInfo_Locale>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
|
||||||
|
<DCC_UnitSearchPath>..\source;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||||
<DCC_UsePackage>rtl;vcl;fmx;$(DCC_UsePackage)</DCC_UsePackage>
|
<DCC_UsePackage>rtl;vcl;fmx;$(DCC_UsePackage)</DCC_UsePackage>
|
||||||
@ -100,6 +110,11 @@
|
|||||||
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
|
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
|
||||||
<DCC_RangeChecking>true</DCC_RangeChecking>
|
<DCC_RangeChecking>true</DCC_RangeChecking>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||||
@ -303,10 +318,10 @@
|
|||||||
<Source Name="MainSource">CEF4Delphi_FMX.dpk</Source>
|
<Source Name="MainSource">CEF4Delphi_FMX.dpk</Source>
|
||||||
</Source>
|
</Source>
|
||||||
<Excluded_Packages>
|
<Excluded_Packages>
|
||||||
<Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\DCLComponentes_UI.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\DCLComponentes_UI.bpl not found</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl260.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl250.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\DataExplorerDBXPluginEnt260.bpl">DBExpress Enterprise Data Explorer Integration</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k260.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
<Excluded_Packages Name="$(BDSBIN)\dclofficexp260.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||||
</Excluded_Packages>
|
</Excluded_Packages>
|
||||||
</Delphi.Personality>
|
</Delphi.Personality>
|
||||||
<Deployment Version="3">
|
<Deployment Version="3">
|
||||||
|
Binary file not shown.
@ -50,7 +50,10 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
{$IFDEF MSWINDOWS}WinApi.Windows, Vcl.Forms,{$ENDIF} System.Classes, System.UITypes,
|
{$IFDEF MSWINDOWS}
|
||||||
|
WinApi.Windows, {$IFNDEF FMX}Vcl.Forms,{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
System.Classes, System.UITypes,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
{$IFDEF MSWINDOWS}Windows, Forms,{$ENDIF} Classes, {$IFDEF FPC}dynlibs,{$ENDIF}
|
{$IFDEF MSWINDOWS}Windows, Forms,{$ENDIF} Classes, {$IFDEF FPC}dynlibs,{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -697,6 +700,7 @@ begin
|
|||||||
if CheckCEFLibrary and LoadCEFlibrary then
|
if CheckCEFLibrary and LoadCEFlibrary then
|
||||||
begin
|
begin
|
||||||
{$IFNDEF FPC}
|
{$IFNDEF FPC}
|
||||||
|
{$IFNDEF FMX}
|
||||||
if FDestroyAppWindows and (ProcessType <> ptBrowser) and (Application <> nil) then
|
if FDestroyAppWindows and (ProcessType <> ptBrowser) and (Application <> nil) then
|
||||||
begin
|
begin
|
||||||
// This is the fix for the issue #139
|
// This is the fix for the issue #139
|
||||||
@ -712,6 +716,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
TempApp := TCustomCefApp.Create(self);
|
TempApp := TCustomCefApp.Create(self);
|
||||||
Result := (ExecuteProcess(TempApp) < 0) and InitializeLibrary(TempApp);
|
Result := (ExecuteProcess(TempApp) < 0) and InitializeLibrary(TempApp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user