[Lazarus] Confused by help
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Sun Mar 23 23:23:21 CET 2014
On 2014-03-23 19:50, Mattias Gaertner wrote:
> Please describe where the event should be added, what the parameters
> and result do, what the default implementation does, for those people
> not having Kylix.
Marco explained it. The event should replace the TApplication.OnHelp and
TCustomForm.OnHelp implementations.
Here is the details as described by the Kylix documentation.
============================================================
THelpEvent defines event handlers for user help requests.
Unit
----
QForms
Delphi syntax:
--------------
type
THelpEvent = function (HelpType: THelpType; HelpContext: Integer;
HelpKeyword: string; HelpFile: string; var Handled: Boolean): Boolean of
object;
Description
-----------
The help request event handler has the following parameters.
HelpType indicates whether the help topic is identified by context ID or
by keyword.
HelpContext identifies the help topic to display when HelpType is htContext.
HelpKeyword identifies the help topic to display when HelpType is htKeyword.
HelpFile identifies the help file that contains the specified topic.
Handled returns an indication of whether the default help system should
display the specified topic after the event handler exits. Set Handled
to true if the event handler displays a help topic, and this prevents
the application from proceeding to display the identified topic.The
event handler should return true if it succeeds, false if it fails.
============================================================
The OnHelp event handler is defined for the TApplication and TCustomForm
classes.
Here is the OnHelp event (TApplication) documentation
============================================================
Occurs when the application receives a request for help.
Delphi syntax:
property OnHelp: THelpEvent;
Description
Write an OnHelp event handler to perform special processing when the
user requests help. This event occurs when the help system is invoked by
a call to InvokeHelp, ContextHelp, or KeywordHelp.The event handler
returns true if it succeeds, false if it fails.
============================================================
Here is a very simplistic example as shown by the Kylix help.
============================================================
The following code changes the Help file depending on the active form,
before the help viewer is called. AppHelp is assigned to the OnHelp
event handler of Application in the OnCreate event of Form1.
function TForm1.AppHelp(Command: Word; Data: Longint; var CallHelp:
Boolean): Boolean;
begin
Application.HelpFile := Screen.ActiveForm.Name + '.hlp';
CallHelp := True;
end;
function TForm1.FormCreate(Sender: TObject);
begin
Application.OnHelp := AppHelp;
end;
============================================================
As Marco mentioned, the THelpEvent, as currently defined, is right out
of the Win32 documentation on how to communicate with the MS Windows
.HLP help viewer.
I hope this answers your question.
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
More information about the Lazarus
mailing list