[Lazarus] ChmHelpPkg: better way to show all CHMs when starting lhelp?

Reinier Olislagers reinierolislagers at gmail.com
Sat Jul 21 13:56:21 CEST 2012

Hi list,

Editing ChmHelpPkg to try and solve bug 22110 Help (at least CHM help)
should open all help files to enable content/index search

I want to open all .chm files in the help database when starting up
lhelp, which allows browsing and searching through the entire
documentation set.

See modified code below.

Though this seems to work (I get the RTL, FCL, LCL and reference guide
CHMs displayed, and the proper help subject is shown), it's clunky:
- using built-in sleep periods seems clunky. Tried removing this, but
IIRC the reference guide then fails to load.
- the commented out mime type support detection seems to fail, which
causes other help databases to display (e.g. browser-based help)
- lhelp flashes while the dbs are being loaded; I suppose there's
nothing we can do about that?

Any suggestions?



function TChmHelpViewer.ShowNode(Node: THelpNode; var ErrMsg: string):
  WasRunning: boolean;
  if ExtractFileNameOnly(GetHelpExe) = 'lhelp' then begin
    //start of modifications
    fHelpConnection.StartHelpServer(HelpLabel, GetHelpExe);
    // If the server is not already running, open all chm files after it
has started
    // This will allow cross-chm (LCL, FCL etc) searching and browsing
in lhelp.
    if not(WasRunning) then begin
      for i := 0 to HelpDatabases.Count-1 do begin
        //this doesn't seem to work - no dbs opened:
        //if HelpDatabases[i].SupportsMimeType('application/x-chm') then
begin // Only open chm help files
        Sleep(200); //give viewer chance to open file. todo: better way
of doing this?
    //end of modifications
    Res := fHelpConnection.OpenURL(FileName, Url);

More information about the Lazarus mailing list