[Lazarus] THelpEvent declaration discussion

Graeme Geldenhuys graeme at mastermaths.co.za
Fri Nov 6 10:36:54 CET 2009


Mattias Gärtner wrote:
> 
> Lazarus type signature: THelpEvent = function(Command: Word; Data:
> PtrInt; var CallHelp: Boolean): Boolean of object;
> 
> Where Data is PHelpInfo. It is used by the widgetsets.

And which seems the same as FPC's THelpEvent, except for the type of the
Data parameter. And any average Joe will know that Data means
PHelpInfo??? I don't think so. Not even the RTL or LCL help mentions
that - see links below.


> I miss a "Sender: TObject".

Why, OnHelp only exists in TForm. No other class has a OnHelp event.


> I see no gain in Kylix compatibility. Lazarus has already a help
> system, which is quite different from Delphi's.


It's not about Kylix compatibility either. It's about having more
unambiguous parameter names and much clearer meaning of each parameter!

  Command: Word:    // No idea what that means or what are valid values
  Data: PntInt;     // No idea what that mean or what it points to
  var CallHelp      // No idea either?

Compare those parameter names to the following:

  HelpType: THelpType;
  HelpContext: THelpContext;
  HelpKeyword: String;
  HelpFile: String;

Any developer can figure out the second lot of parameters without the
need to open a manual or online help document. Not to mention that
neither Lazarus or FPC has help that explains the current meaning of the
parameters in THelpEvent. Currently it's only a select few developers (
I guess) that know the meaning or those parameters. What still about the
 structure that Data points to?


http://lazarus-ccr.sourceforge.net/docs/lcl/forms/thelpevent.html
http://www.freepascal.org/docs-html/rtl/classes/thelpevent.html


So considering that Application.HelpFile, TComponent.HelpContext,
TComponent.HelpType and TComponent.HelpKeyword exists. How do you
translate what comes currently though the OnHelp event handler to
something like is it Context ID or a KeyWord etc?


As for the elusive PHelpInfo type (seeing that you mentioned what Data
actualy contains). After browsing for quite some time I eventually
seemed to find PHelpInfo. There is not link in the online help from
OnHelp or THelpInfo to PHelpInfo by the way.

Anyway, this is what I found and I think it's ridiculously complicated.
PHelpInfo is a pointer to THelpInfo which is a alias type to tagHelpInfo
which is finally a record type with 6 fields. And out of those 6 fields
not a single one uses the existing help types we have available:
THelpType, THelpContext.

And you don't think that is more complicated to what I am suggesting?



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/





More information about the Lazarus mailing list