You can either:
Assign a handler to the OnHelp event of
TApplication/Events
.Write a class that implements the
ICustomHelpViewer
andIExtendedHelpViewer
interfaces, and then register that class for use viaRegisterViewer()
.
Question
In the TForm
we have the HelpFile
, HelpType
and HelpKeyword
properties. We set the file and keyword. when we press F1 the magic comes. Everybody knows it.
But what if we want to use a data base with keyword
and help
fields and create a new custom form to show the help, using the HelpKeyword
from the visual components to know which db record to show in the custom form, disabling the standard windows help system. Can we do that? How?
Solution
You can either:
Assign a handler to the OnHelp event of TApplication/Events
.
Write a class that implements the ICustomHelpViewer
and IExtendedHelpViewer
interfaces, and then register that class for use via RegisterViewer()
.
OTHER TIPS
Yes. See the TApplication.OnHelp
event. You can easily connect it using a TApplicationEvents
component (on the Additional
component palette) in recent Delphi versions, or declare it yourself in older versions that don't have that component.
function TForm1.ApplicationEvents1Help(Command: Word; Data: NativeInt;
var CallHelp: Boolean): Boolean;
begin
// Stop normal help processing from being called
CallHelp := False;
// Command is the help command being sent.
// Data is the context information; it varies based on Command
// Use them to decide what your help window should do, and what
// it should display
end;