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

Reinier Olislagers reinierolislagers at gmail.com
Mon Oct 29 10:13:07 CET 2012


Let's see if somebody has some good ideas about the problem described below.

Thanks,
Reinier

On 21-7-2012 13:56, Reinier Olislagers wrote:
> 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)
====> this is my main problem.

Any hints on how to solve this?
Thanks.

> - lhelp flashes while the dbs are being loaded; I suppose there's
> nothing we can do about that?

> lazarus\components\chmhelp\packages\idehelp\lazchmhelp.pas
> 
> function TChmHelpViewer.ShowNode(Node: THelpNode; var ErrMsg: string):
> TShowHelpResult;
> var
> ...
>   WasRunning: boolean;
> ...
>   if ExtractFileNameOnly(GetHelpExe) = 'lhelp' then begin
>     //start of modifications
>     WasRunning:=fHelpConnection.ServerRunning;
>     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
>         HelpDatabases[i].ShowTableOfContents;
>         Sleep(200); //give viewer chance to open file. todo: better way
> of doing this?
>       end;
>     end;
>     //end of modifications
>     Res := fHelpConnection.OpenURL(FileName, Url);
> 





More information about the Lazarus mailing list