Recent

Author Topic: Display help file on F1 in Lazarus  (Read 2896 times)

bnl

  • New Member
  • *
  • Posts: 15
Display help file on F1 in Lazarus
« on: April 05, 2020, 06:09:23 pm »

Hi!
Using fpc and Lazarus on the mac I have a problem.

So I fire up Lazarus, and mark a unit in the source window.
I then press F1.
Here I expect some help to show but I get a modal window,
on top of Lhelp, displaying this message


Lhelp
Invalid file handle.

Press OK to ignore and risk data corruption.
Press Abort to kill the program.


Lazarus 2.0.6
macos 10.13.6 - High Sierra


In the Lazarus options/Help I see that FPC Doc HTML Path is blank.
And so is the CHM help viewer section. (I guess Lhelp is a chm reader?)
Where would I find the help-files?

And what settings should I fix
Install via macports in /opt

Bjorns-MBP:Desktop bnl$ which fpc
/opt/local/bin/fpc

I did post this on Mac-pascal list but I guess I'm alone int there,
No reply after almost a week


/Björn


Leledumbo

  • Hero Member
  • *****
  • Posts: 8747
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Display help file on F1 in Lazarus
« Reply #1 on: April 05, 2020, 06:45:48 pm »
In the Lazarus options/Help I see that FPC Doc HTML Path is blank.
And so is the CHM help viewer section. (I guess Lhelp is a chm reader?)
Where would I find the help-files?
Get them here: https://sourceforge.net/projects/lazarus/files/Lazarus%20Documentation/Lazarus%202.0.6/
I think these should come preinstalled and preconfigured in the installation package, those who don't want can download the source code package instead. Maybe this is something to consider by the installation packager team.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Display help file on F1 in Lazarus
« Reply #2 on: April 05, 2020, 07:04:01 pm »
In the Lazarus options/Help I see that FPC Doc HTML Path is blank.
And so is the CHM help viewer section. (I guess Lhelp is a chm reader?)

In a normal Lazarus installation the first ("FPC Doc HTML Path" blank) is normal (unless you use the uncompressed HTML help), but (IIRC) the "CHM help viewer" should point to lhelp (usually "$(LazarusDir)/components/chmhelp/lhelp/lhelp").

It may be different for MacOS X, though; I have no experience with that system :-[
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Display help file on F1 in Lazarus
« Reply #3 on: April 05, 2020, 10:03:25 pm »

but (IIRC) the "CHM help viewer" should point to lhelp (usually "$(LazarusDir)/components/chmhelp/lhelp/lhelp").

No, not on Linux or Windows (I do not have Mac either, but it's probably same).

Under the "CHM help viewer":
- Only "HelpFilesPath" should contain the path to folder with chm files (not to lhelp binary).
- All other fields should normally remain blank (including "HelpExe"). I believe you should fill these only if you want to use some chm viewer other than lhelp.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Display help file on F1 in Lazarus
« Reply #4 on: April 05, 2020, 11:36:51 pm »
Under windows afaik you only have to toss the CHMs in the lazarus\chm dir and it works. The defaults nowadays just work.

If you build pure SVN, you might have to install the chmhelp+lhelp package, but afaik the release already prebuilds that. And also then afaik there is no  (more) additional configuration required.

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Display help file on F1 in Lazarus
« Reply #5 on: April 06, 2020, 06:03:12 am »
If you build pure SVN, you might have to install the chmhelp+lhelp package,

You need "make bigide". That is all.

Zoran

  • Hero Member
  • *****
  • Posts: 1829
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Display help file on F1 in Lazarus
« Reply #6 on: April 06, 2020, 06:07:12 am »
- Only "HelpFilesPath" should contain the path to folder with chm files (not to lhelp binary).

Under windows afaik you only have to toss the CHMs in the lazarus\chm dir and it works. The defaults nowadays just work.

You are right of course. I put chm's in non-default location. That is why I have to fill "HelpFilesPath"

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Display help file on F1 in Lazarus
« Reply #7 on: April 06, 2020, 09:34:44 am »
but (IIRC) the "CHM help viewer" should point to lhelp (usually "$(LazarusDir)/components/chmhelp/lhelp/lhelp").

No, not on Linux or Windows (I do not have Mac either, but it's probably same).

I checked and my (Linux) boxes have that value there (in HelpEXE). Then I thought it may be a leftover of my tries to use another viewer so I tested deleting it and you're right: it seems that if there's nothing there Lazarus just goes and uses its default lhelp binary :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

bnl

  • New Member
  • *
  • Posts: 15
Re: Display help file on F1 in Lazarus
« Reply #8 on: April 06, 2020, 11:05:09 pm »
hmm, So I find the chms at /opt/local/share/lazarus/docs/chm.

Bjorns-MBP:chm bnl$ ls /opt/local/share/lazarus/docs/chm
LazReadme.txt   fcl.xct      fclres.xct   lazutils.chm   lcl.chm      prog.chm   ref.chm      rtl.chm      toc.chm
fcl.chm      fclres.chm   fpdoc.chm   lazutils.xct   lcl.xct      readmechm.txt   ref.kwd      rtl.xct      user.chm

However, even if I put that path in Options| help|Chm|helpfiles path
I still get corrupted file msgbox.
Lhelp starts, and I can manually browse to the chms, and open them.
But I cannot put the cursor on a unit or reserved word and press F1 for more help.
/Björn

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Display help file on F1 in Lazarus
« Reply #9 on: April 07, 2020, 12:16:29 am »
So I fire up Lazarus, and mark a unit in the source window.
I then press F1.
Here I expect some help to show but I get a modal window,
on top of Lhelp, displaying this message


Lhelp
Invalid file handle.

Press OK to ignore and risk data corruption.
Press Abort to kill the program.
This reminds me of a recent discussion here. I just tested your description with a demo that I was writing for another post. This demo contains a panel and a chart. When I put the cursor on the TChart identifier or the TAGraph unit in the source text and press F1, I get the error message that you describe. But when I put the cursor on the panel or one of the LCL units, e.g. ExtCtrls, the help works correctly.

Therefore, I suspect that the help works only for the chm files registered. There is a chm file also for TAChart, but I don't know how to register it, and therefore, the IDE does not find it and displays the invalid file error.

So, my question is: on which identifier do you put the cursor to call help for? Does it exist in one of the registered chm files?

bnl

  • New Member
  • *
  • Posts: 15
Re: Display help file on F1 in Lazarus
« Reply #10 on: April 07, 2020, 08:48:36 am »
Ahh, some progress - I thought

Code: Pascal  [Select][+][-]
  1. uses
  2.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs;
  3.  
  4. type
  5.   TForm1 = class(TForm)
  6.   private
  7.  
  8.   public
  9.  
                   
I get that message on all units listed above.
I thin they are basic/core as opposed to Tgraph?
On key words like private/public I get first a helps selecting popup.
There a number of lines with that word is in a listbox and I'm asked to pick
one of them. like setting the cursor in the word 'private'
  • Private
  • Private(2)
  • Private(3)

When I pick any of them, I get back to square one - same message again,
Help started but with msgbox
"Invalid file handle"
again.

Thanks for replying

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Display help file on F1 in Lazarus
« Reply #11 on: April 14, 2020, 02:49:33 am »
hmm, So I find the chms at /opt/local/share/lazarus/docs/chm.

Weird. On macOS Mojave I find this:

trev@macmini6 [/Users/trev] $ locate \.chm
/Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/compiler/pic32-tools/doc/hlpPIC32MXConfigSet.chm
/Library/Lazarus/docs/chm/fcl.chm
/Library/Lazarus/docs/chm/fclres.chm
/Library/Lazarus/docs/chm/fpdoc.chm
/Library/Lazarus/docs/chm/lazutils.chm
/Library/Lazarus/docs/chm/lcl.chm
/Library/Lazarus/docs/chm/prog.chm
/Library/Lazarus/docs/chm/ref.chm
/Library/Lazarus/docs/chm/rtl.chm
/Library/Lazarus/docs/chm/toc.chm
/Library/Lazarus/docs/chm/user.chm


Lazarus -> Preferences -> Help (IDE options) is empty as per the attached image.

The CHM Help works for me, although there's an occasional error dialog when exiting the help, the error seems harmless.

 

TinyPortal © 2005-2018