mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-01-23 10:24:51 +02:00
Fixed SimpleBrowser2 demo for Lazarus in Windows
This commit is contained in:
parent
5347d34205
commit
401a622bf8
@ -3,13 +3,11 @@ program SimpleBrowser2;
|
|||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
|
||||||
cthreads,
|
|
||||||
{$ENDIF}{$ENDIF}
|
|
||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, uSimpleLazarusBrowser,
|
Forms,
|
||||||
{ you can add units after this }
|
{ you can add units after this }
|
||||||
uCEFApplication;
|
uCEFApplication,
|
||||||
|
uSimpleBrowser2 in 'uSimpleBrowser2.pas' {Form1};
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
@ -19,8 +17,22 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
CreateGlobalCEFApp;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
|
||||||
|
// In case you want to use custom directories for the CEF3 binaries, cache and user data.
|
||||||
|
// If you don't set a cache directory the browser will use in-memory cache.
|
||||||
|
{
|
||||||
|
GlobalCEFApp.FrameworkDirPath := 'c:\cef';
|
||||||
|
GlobalCEFApp.ResourcesDirPath := 'c:\cef';
|
||||||
|
GlobalCEFApp.LocalesDirPath := 'c:\cef\locales';
|
||||||
|
GlobalCEFApp.EnableGPU := True; // Enable hardware acceleration
|
||||||
|
GlobalCEFApp.cache := 'c:\cef\cache';
|
||||||
|
GlobalCEFApp.UserDataPath := 'c:\cef\User Data';
|
||||||
|
}
|
||||||
|
|
||||||
|
// You *MUST* call GlobalCEFApp.StartMainProcess in a if..then clause
|
||||||
|
// with the Application initialization inside the begin..end.
|
||||||
|
// Read this https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
if GlobalCEFApp.StartMainProcess then
|
if GlobalCEFApp.StartMainProcess then
|
||||||
begin
|
begin
|
||||||
RequireDerivedFormResource := True;
|
RequireDerivedFormResource := True;
|
||||||
@ -29,6 +41,7 @@ begin
|
|||||||
Application.Run;
|
Application.Run;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DestroyGlobalCEFApp;
|
GlobalCEFApp.Free;
|
||||||
|
GlobalCEFApp := nil;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
*
|
*
|
||||||
*)
|
*)
|
||||||
|
|
||||||
unit uSimpleLazarusBrowser;
|
unit uSimpleBrowser2;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
@ -97,8 +97,6 @@ type
|
|||||||
var
|
var
|
||||||
Form1 : TForm1;
|
Form1 : TForm1;
|
||||||
|
|
||||||
procedure CreateGlobalCEFApp;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
@ -128,14 +126,6 @@ uses
|
|||||||
|
|
||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
|
|
||||||
|
|
||||||
procedure CreateGlobalCEFApp;
|
|
||||||
begin
|
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
|
||||||
//GlobalCEFApp.LogFile := 'cef.log';
|
|
||||||
//GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FCanClose := False;
|
FCanClose := False;
|
||||||
@ -249,7 +239,7 @@ end;
|
|||||||
|
|
||||||
procedure TForm1.BrowserCreatedMsg(var aMessage: TMessage);
|
procedure TForm1.BrowserCreatedMsg(var aMessage: TMessage);
|
||||||
begin
|
begin
|
||||||
Caption := 'Simple Lazarus Browser';
|
Caption := 'Simple Browser 2';
|
||||||
AddressPnl.Enabled := True;
|
AddressPnl.Enabled := True;
|
||||||
GoBtn.Click;
|
GoBtn.Click;
|
||||||
end;
|
end;
|
@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 312,
|
"InternalVersion" : 313,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "92.0.25.0"
|
"Version" : "92.0.25.0"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user