Showing Help with the TGeckoBrowser Component in Lazarus

We recommend the lazplanet instructions for downloading, installing and using the TGeckoBrowser component with the following additional guidance. We tested the instructions with Version 1.4 of Lazarus. With our set-up, when we double clicked on the package file it merely loaded into the Lazarus text editor. These are alternative instructions for installing TGeckoBrowser:
  1. Select menu item Package > Open Package File (.lpk)...
  2. Navigate to where you extracted GeckoComponents.lpk and open it.
  3. Select menu item Use >> > Install and accept the invitation to continue.

The XULRunner zip file that we downloaded was xulrunner-3.6.26.en-US.win32.zip.

We created a browser following the instructions in Part 2 of the lazplanet guide. The code of proj_gecko_test.lpr is:

program proj_gecko_test;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Forms, frm1
  {$IFDEF LCL}
    ,Interfaces
    {$IFDEF MSWINDOWS}
      ,Math
    {$ENDIF}
  {$ENDIF}
  ;

{$R *.res}

begin
  {$IFDEF FPC}
    {$IFDEF MSWINDOWS}
      //For now - disable all floating point exceptions or XULRUNNER will crash.
      SetExceptionMask([exInvalidOp,exDenormalized,exZeroDivide,exOverflow,exUnderflow,exPrecision]);
    {$ENDIF}
  {$ENDIF}
  RequireDerivedFormResource := True;
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.    
We set up the browser to point at our first (local) help file by initialising the HomePage variable with this line of code.
HomePage: string = 'file:///C:/Working/gecko_test/Helpfile.html';    

Note that although TGeckoBrowser is much more modern than the inbuilt browser described on the preceding page, it will not display the HLML5 files that we create with Smart Mobile Studio.

Programming - a skill for life!

How to provide help in Delphi and Lazarus applications