RAD Studio
ContentsIndex
PreviousUpNext
Implementing IExtendedHelpViewer

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

Applications can talk to systems requiring context-based Help by extending the object that implements ICustomHelpViewer to also implement 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. The built-in WinHelp viewer does this for you automatically. 

IExtendedHelpViewer exposes four functions. Two of them—UnderstandsContext and DisplayHelpByContext—are used to support context-based Help; the other two—UnderstandsTopic and DisplayTopic—are used to support topics. 

When an application user presses F1, the Help Manager calls

IExtendedHelpViewer.UnderstandsContext(const ContextID: Integer;
const HelpFileName: String): Boolean

 

int__fastcall IExtendedHelpViewer::UnderstandsContext(const int ContextID, AnsiString 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. Unlike the case with ICustomHelpViewer.UnderstandsKeyword, however, 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

IExtendedHelpViewer.DisplayHelpByContext(const ContextID: Integer;
const HelpFileName: String)

 

void__fastcall IExtendedHelpViewer::DisplayHelpByContext(const int ContextID, AnsiString
HelpFileName)

after it has polled the registered Help viewers. 

The topic support functions work the same way:

IExtendedHelpViewer.UnderstandsTopic(const Topic: String): Boolean

 

bool__fastcall IExtendedHelpViewer::UnderstandsTopic(const AnsiString Topic)

is used to poll the Help viewers asking if they support a topic;

IExtendedHelpViewer.DisplayTopic(const Topic: String)

 

void__fastcall IExtendedHelpViewer::DisplayTopic(const AnsiString Topic)

is used to invoke the first registered viewer which reports that it is able to provide help for that topic.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!