System.HelpIntfs.RegisterViewer

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function RegisterViewer(const newViewer: ICustomHelpViewer; out Manager: IHelpManager): Integer;

C++

extern DELPHI_PACKAGE int __fastcall RegisterViewer(const _di_ICustomHelpViewer newViewer, /* out */ _di_IHelpManager &Manager);

Properties

Type Visibility Source Unit Parent
function public
System.HelpIntfs.pas
System.HelpIntfs.hpp
System.HelpIntfs System.HelpIntfs

Description

Registers the Help Viewer to receive Help requests.

Call RegisterViewer to register a Help Viewer with the Help System. An application can register any number of Viewers. The order in which Help Viewers are registered is significant, because each Help request causes the RTL Help System to poll the Viewers in the order they were registered, and give the Help request to the first viewer that claims to be able to handle it. An application can override this behavior for keyword-based Help requests and for requests to display a Table of Contents by providing a Help Selector object.

Pass the Help Viewer object in the newViewer parameter.

RegisterViewer returns a Help Manager object in the Manager parameter; the Help Viewer uses this object to interact with the Help System.

The return value of RegisterViewer is True is the Viewer was successfully registered, False otherwise.

The VCL library defines the Vcl.HtmlHelpViewer unit, which provides a Delphi interface to the HTMLHelp external Help Viewer. HTMLHelp is the Windows native Help handling function. To register the HTMLHelp-based Help Viewer in your application, you can insert in the uses clause of your application the Vcl.HtmlHelpViewer unit. The initialization section of the Vcl.HtmlHelpViewer unit calls RegisterViewer to register the created Help Viewer:

 initialization
   HelpViewer := THtmlHelpViewer.Create;
   System.HelpIntfs.RegisterViewer(HelpViewerIntf, HelpViewer.FHelpManager);

Here:

  • The THtmlHelpViewer.Create constructor in the first line internally creates the Help Viewer object HelpViewerIntf.
  • The second line calls the RegisterViewer function, which registers this Help Viewer.

The global System.HelpIntfs.GetHelpSystem function can be called from other units to access to methods of Help Systems from the registered Help Viewer.