LiteHelp For Delphi

LiteHelp is a lightweight portable context-sensitive help system for Windows desktop apps. You can read more about it in this post: https://www.dmitripopov.com/introducing-litehelp/

I also created a Delphi unit that allows to integrate LiteHelp into the context-sensitive help of Delphi VCL. It works pretty much the same way HTMLHelpViewer.pas works – just include it into your uses list and provide path to the folder where the help is located using Application.HelpFile. Also you will need to place LiteHelpViewer.exe in the same folder with your main executable. Now Delphi will run LiteHelpViewer.exe and browse to ContextID automatically. You can also locate keywords, execute search and switch languages using commands shown in the Delphi demo included into Delphi distributions that you can download from this link: http://www.helpinator.com/downloads/litehelpdelphi.zip

Here are some code samples

Sample No 1: LiteHelpViewer in your “uses” list:

unit uMain;

interface

uses
  LiteHelpViewer, Winapi.Windows, Winapi.Messages, System.SysUtils,
  System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm1 = class(TForm)

Sample No 2: Setting path to the help folder in the project source:

program LiteHelpViewerDemo;

uses
  SysUtils,
  Vcl.Forms,
  uMain in 'uMain.pas' {Form1};

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  // It's important to provide full path to the folder with LiteHelp files
  Application.HelpFile := IncludeTrailingBackSlash(ExtractFileDir(Application.Exename)) + 'help';
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

Sample No3: Executing some important help system commands:

// Open Table of Contents
procedure TForm1.btnOpenTableOfContentsClick(Sender: TObject);
begin
  Application.HelpShowTableOfContents;
end;

// Execute search for a term in edtSearch TEdit
procedure TForm1.btnSearchClick(Sender: TObject);
begin
  IHelpSystem3(Application.HelpSystem).ShowSearch(Trim(edtSearch.Text), Application.HelpFile);
end;

// Locate keyword from edtKeyword TEdit
procedure TForm1.btnGoToKeywordClick(Sender: TObject);
begin
  IHelpSystem3(Application.HelpSystem).ShowIndex(Trim(edtKeyword.Text), Application.HelpFile);
end;

Leave a comment

Leave a Reply

%d bloggers like this: