Fixed SimpleBrowser2 demo for Lazarus in Windows

This commit is contained in:
Salvador Díaz Fau 2021-08-10 10:00:07 +02:00
parent 5347d34205
commit 401a622bf8
4 changed files with 23 additions and 20 deletions

View File

@ -3,13 +3,11 @@ program SimpleBrowser2;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, uSimpleLazarusBrowser,
Forms,
{ you can add units after this }
uCEFApplication;
uCEFApplication,
uSimpleBrowser2 in 'uSimpleBrowser2.pas' {Form1};
{$R *.res}
@ -19,8 +17,22 @@ uses
{$ENDIF}
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
begin
RequireDerivedFormResource := True;
@ -29,6 +41,7 @@ begin
Application.Run;
end;
DestroyGlobalCEFApp;
GlobalCEFApp.Free;
GlobalCEFApp := nil;
end.

View File

@ -35,7 +35,7 @@
*
*)
unit uSimpleLazarusBrowser;
unit uSimpleBrowser2;
{$mode objfpc}{$H+}
@ -97,8 +97,6 @@ type
var
Form1 : TForm1;
procedure CreateGlobalCEFApp;
implementation
{$R *.lfm}
@ -128,14 +126,6 @@ uses
{ TForm1 }
procedure CreateGlobalCEFApp;
begin
GlobalCEFApp := TCefApplication.Create;
//GlobalCEFApp.LogFile := 'cef.log';
//GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FCanClose := False;
@ -249,7 +239,7 @@ end;
procedure TForm1.BrowserCreatedMsg(var aMessage: TMessage);
begin
Caption := 'Simple Lazarus Browser';
Caption := 'Simple Browser 2';
AddressPnl.Enabled := True;
GoBtn.Click;
end;

View File

@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 312,
"InternalVersion" : 313,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "92.0.25.0"
}