Implementing IExtendedHelpViewer

From RAD Studio
Jump to: navigation, search

Go Up to Help System Interfaces

System.HelpIntfs.ICustomHelpViewer provides direct support only for a keyword-based Help. Some Help systems (especially HTMLHelp) work by associating numbers (known as context IDs) with help topics in a fashion which is internal to the Help system and, therefore, not visible to the application. Such systems require that the application supports a context-based Help in which the application invokes the Help system with that numeric context ID, rather than with a keyword string, and the Help system translates the context ID number itself.

Applications can talk to systems requiring context-based Help by extending the object that implements ICustomHelpViewer to also implement System.HelpIntfs.IExtendedHelpViewer. IExtendedHelpViewer also provides support for talking to Help systems that allow you to jump directly to high-level topics instead of using keyword searches.

IExtendedHelpViewer exposes 4 functions:

When an application user presses F1, the Help Manager calls

UnderstandsContext(const ContextID: Integer; const HelpFileName: String): Boolean
int __fastcall UnderstandsContext(const int ContextID, UnicodeString HelpFileName)

and the currently activated control supports context-based, rather than keyword-based Help. As with ICustomHelpViewer.UnderstandsKeyword, the Help Manager queries all registered Help viewers iteratively. However, unlike the case with ICustomHelpViewer.UnderstandsKeyword, if more than one viewer supports a specified context, the first registered viewer with support for a given context is invoked.

The Help Manager calls

DisplayHelpByContext(const ContextID: Integer; const HelpFileName: String)
void __fastcall DisplayHelpByContext(const int ContextID, UnicodeString HelpFileName)

after it has polled the registered Help viewers.

The topic support functions work the same way:

UnderstandsTopic(const Topic: String): Boolean
bool __fastcall UnderstandsTopic(const UnicodeString Topic)

is used to poll the Help viewers asking if they support a topic name matching the specified Topic string.

DisplayTopic(const Topic: String)
void __fastcall DisplayTopic(const UnicodeString Topic)

is used to invoke the first registered viewer that reports that it is able to provide a Help topic whose topic name matches the specified Topic.

See Also