[Lazarus] LHelp or help systems that also work on..
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Fri Nov 18 14:16:47 CET 2016
On 2016-11-18 11:36, Lars via Lazarus wrote:
> Since I use both Lazarus and Delphi and never just use one or the other,
> is there any help system that works in both delphi and Lazarus?
Yes, Docview and INF help can be used in both cases. I already posted a
full example project for Lazarus LCL applications in the Lazarus Forums.
For Delphi applications you can do the following. Simply set the
HelpContext values for each component or form - as you normally would.
Then implement a global help event handler as shown below. This simply
catches the help request, then launches DocView with the correct
parameters to display the help topic in question.
ps:
There is a known bug in Delphi 7 where Application.OnHelp is never
called. Later Delphi versions have fixed this bug. If the application
is compiled with Delphi 7, then you need to simply catch the WM_HELP
message in the form, and call AppHelp() explicitly.
========================================
function TForm1.AppHelp(Command: Word; Data: Integer; var CallHelp:
Boolean): Boolean;
const
cEXE = 'c:\apps\docview.exe myapp.inf -n %d';
var
SI: TStartupInfo;
PI: TProcessInformation;
cmd: string;
begin
if Command = HELP_CONTEXT then
CallHelp := False
else
begin
Result := True;
CallHelp := True; // don't do anything ourselves.
Exit;
end;
// if we got here, we must display some help.
cmd := Format(cEXE, [Data]);
GetStartupInfo(SI);
// do whatever other setup info you want
CreateProcess(nil, PChar(cmd), nil, nil, False, 0, nil, nil, SI, PI);
Result := True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.HelpFile := 'myapp.inf';
Application.OnHelp := AppHelp;
end;
==========================================
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the Lazarus
mailing list