Recent

Author Topic: Application Help System - what do you use?  (Read 13255 times)

trevosx

  • Newbie
  • Posts: 6
Application Help System - what do you use?
« on: October 13, 2009, 10:58:56 am »
So far as I can tell, the Lazarus help components in the System tab do not work under OS X. I compiled the example help project and neither the Help button nor the edit box help works. (Lazarus 0.9.26.2, FPC 2.2.4).

In the meantime, I'm pursuing the Turbopower html panel solution for a relatively simple bunch of help files. Although I did toy with the idea of trying to call the OS X help viewer subsystem for a while which would probably have been the better solution but as I've only been using Lazarus/FPC for a week, and have never programmed an OS X GUI app before... it's  atd beyonf my current capabilities.

Anyway, what is everyone else using for their help system?

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Application Help System - what do you use?
« Reply #1 on: October 13, 2009, 04:44:28 pm »
Now that Lazarus 0.9.28 is officially out, try that and see if the example help project works any better.

I use the HelpUtil.pas unit from this project:

http://wiki.lazarus.freepascal.org/XDev_Toolkit

HelpUtil creates a THelpManager descendant that has some conditionally compiled code to handle platform differences. You can see how easy it is to open an HTML file in the OS X Help Viewer. However, HelpUtil does not jump to a topic on OS X. I played around with doing that but never added it to HelpUtil.

Here is my test code for using the Apple Help AHGoToHelp function to jump to a topic in the help file (located in app bundle). You can probably adapt this code for use in HelpUtil's DoHelpCommand or something. I haven't tested this code in over 3 years but it should still work.

Thanks.

-Phil


program TestAH;

uses
  SysUtils,
  FPCMacOSAll;

const
  DEFAULT_CFSTRING_ENCODING = kCFStringEncodingUTF8; 
var
  HtmlFileName   : string;
  AnchorName     : string;
  BundleRef      : CFBundleRef;
  BundleURL      : CFURLRef;
  BundFsRef      : FSRef;
  HbCFStrRef     : CFStringRef;
  FileCFStrRef   : CFStringRef;
  AnchorCFStrRef : CFStringRef;
  Status         : OSStatus;
begin
  HtmlFileName := 'myhelp.html';  //Can be URL too
  WriteLn(HtmlFileName);
  AnchorName := '100';

  BundleRef := nil;
  BundleURL := nil;

  BundleRef := CFBundleGetMainBundle;
  if BundleRef = nil then
    begin
    WriteLn('Error: Bundle reference is nil.');
    Exit;
    end;
  BundleURL := CFBundleCopyBundleURL(BundleRef);
  if BundleURL = nil then
    begin
    WriteLn('Error: Bundle URL path is nil.');
    Exit;
    end;
  if not CFURLGetFSRef(BundleURL, BundFsRef) then
    begin
    WriteLn('Unable to convert bundle URL path to file system reference.');
    Exit;
    end;
  WriteLn(AHRegisterHelpBook(BundFsRef));  //-50 is user param error, -120 is dir not found

  HbCFStrRef := CFBundleGetValueForInfoDictionaryKey(BundleRef,
                                                     CFSTR('CFBundleHelpBookName'));
  FileCFStrRef := CFStringCreateWithCString(nil, Pointer(PChar(HtmlFileName)),
                                            DEFAULT_CFSTRING_ENCODING);
  AnchorCFStrRef := CFStringCreateWithCString(nil, Pointer(PChar(AnchorName)),
                                              DEFAULT_CFSTRING_ENCODING);
  Status := AHGotoPage(HbCFStrRef, FileCFStrRef, AnchorCFStrRef);
  if Status = noErr then
    WriteLn('Request sent to Help Viewer')
  else
    WriteLn('Error ', Status);
  CFRelease(Pointer(FileCFStrRef));
  CFRelease(Pointer(AnchorCFStrRef));

end.


trevosx

  • Newbie
  • Posts: 6
Re: Application Help System - what do you use?
« Reply #2 on: October 17, 2009, 11:20:56 am »
Now that Lazarus 0.9.28 is officially out, try that and see if the example help project works any better.

I downloaded the DMG for that version on October 7. It installed ok but I was unable to use it because it wanted a Leopard dynamic link library version 7, and I'm running Tiger (version 5). I tried re-compiling it, but one of the tools came up with the same error. So I reverted to 0.9.26.2.

Quote
I use the HelpUtil.pas unit from this project:

http://wiki.lazarus.freepascal.org/XDev_Toolkit

Many thanks for that and the code snippet. I'll take a look.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Application Help System - what do you use?
« Reply #3 on: October 17, 2009, 02:38:41 pm »
That doesn't sound good.

Did you get the stable 0.9.28 from SourceForge?

http://sourceforge.net/projects/lazarus/files/

If so, then please post a bug report ASAP under BugTracker at left.

I'm running 0.9.28.1 from the Daily Snapshots on my Mac with 10.4 and it runs fine.

Thanks.

-Phil



trevosx

  • Newbie
  • Posts: 6
Re: Application Help System - what do you use?
« Reply #4 on: October 19, 2009, 12:12:11 pm »
Did you get the stable 0.9.28 from SourceForge?
http://sourceforge.net/projects/lazarus/files/

Yep - just downloaded it again to be sure. Here's what happens after install when trying to run it:

Code: [Select]
dyld: Library not loaded: /usr/lib/libiconv.2.dylib  Referenced from: /Developer/lazarus/lazarus    Reason: Incompatible library version: lazarus requires version 7.0.0 or later, but libiconv.2.dylib provides version 5.0.0
    Trace/BPT trap
    logout
    [Process completed]

Ok, so I better recompile it from source.

Code: [Select]
[...]
Assembling allcodetoolunits
95484 lines compiled, 6.9 sec
make -C ide ide
../tools/svn2revisioninc .. revision.inc
dyld: Library not loaded: /usr/lib/libiconv.2.dylib
  Referenced from: /Developer/lazarus/ide/../tools/svn2revisioninc
    Reason: Incompatible library version: svn2revisioninc requires version 7.0.0 or later, but libiconv.2.dylib provides version 5.0.0
    make[1]: *** [revisioninc] Trace/BPT trap
    make: *** [ide] Error 2

Quote
I'm running 0.9.28.1 from the Daily Snapshots on my Mac with 10.4 and it runs fine.

Hmm - I'll try a daily snapshot and see what happens... exactly the same issue with     lazarus-0.9.28.1.22226-20091019-i386-macosx.dmg on Tiger 10.4.11 with all updates :(

What version of Tiger are you using?
« Last Edit: October 19, 2009, 12:43:35 pm by trevosx »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Application Help System - what do you use?
« Reply #5 on: October 19, 2009, 04:06:08 pm »
In a terminal, change to the Lazarus folder and type this:

otool -L lazarus

That will show what version of iconv it's looking for.

Now switch to /usr/lib and do the same for iconv:

otool -L libiconv.2.dylib

That will show what version you have.

I don't think Lazarus' requirement for iconv changed between 0.9.26 and 0.9.28.

I'm running Tiger 10.4.11 on PowerPC.

Thanks.

-Phil

trevosx

  • Newbie
  • Posts: 6
Re: Application Help System - what do you use?
« Reply #6 on: October 20, 2009, 01:38:48 pm »
In a terminal, change to the Lazarus folder and type this:
otool -L lazarus
That will show what version of iconv it's looking for.

For Lazarus 0.9.26.2:

Code: [Select]
lazarus:
        /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)


For Lazarus 0.9.28:

Code: [Select]
lazarus:
        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

Quote
Now switch to /usr/lib and do the same for iconv:
otool -L libiconv.2.dylib
That will show what version you have.
Code: [Select]
libiconv.2.dylib:
        /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.3)

Quote
I don't think Lazarus' requirement for iconv changed between 0.9.26 and 0.9.28.

Looks like it has.

Quote
I'm running Tiger 10.4.11 on PowerPC.

Tiger 10.4.11 on i386.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Application Help System - what do you use?
« Reply #7 on: October 21, 2009, 12:06:55 am »
I think what this means is that the Intel version of Lazarus 0.9.28 will only run on Leopard and later, whereas the PowerPC version of Lazarus 0.9.28.1 shows it requiring only version 5 of iconv.

I don't think this is intended, so please file a bug report at left under Bugtracker.

Here's what I get with 0.9.28.1 on PowerPC:

        /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 128.0.0)
        /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.12)
        /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)

Thanks.

-Phil

 

TinyPortal © 2005-2018