Contents Up Previous Next

wxHelpInstance: wxClient

The wxHelpInstance class implements the interface by which applications may invoke wxHelp to provide on-line help. Each instance of the class maintains one connection to an instance of wxHelp which belongs to the application, and which is shut down when the Quit member of wxHelpInstance is called (for example in the OnClose member of an application's main frame). Under MS Windows, there is currently only one instance of wxHelp which is used by all applications.

Since there is a DDE link between the two programs, each subsequent request to display a file or section uses the existing instance of wxHelp, rather than starting a new instance each time. wxHelp thus appears to the user to be an extension of the current application. wxHelp may also be invoked independently of a client application.

Normally an application will create an instance of wxHelpInstance when it starts, and immediately call Initialize to associate a filename with it. wxHelp will only get run, however, just before the first call to display something. See the test program supplied with the wxHelp source.

Include the file wx_help.h to use this API, even if you have included wx.h.

If you give TRUE to the constructor, you can use the native help system where appropriate (currently under Windows only). Omit the file extension to allow wxWindows to choose the appropriate file for the platform.

wxHelpInstance::wxHelpInstance
wxHelpInstance::~wxHelpInstance
wxHelpInstance::Initialize
wxHelpInstance::DisplayBlock
wxHelpInstance::DisplayContents
wxHelpInstance::DisplaySection
wxHelpInstance::KeywordSearch
wxHelpInstance::LoadFile
wxHelpInstance::OnQuit
wxHelpInstance::Quit


wxHelpInstance::wxHelpInstance

void wxHelpInstance(Bool native)

Constructs a help instance object, but does not invoke wxHelp. If native is TRUE, tries to use the native help system where possible (Windows Help under MS Windows, wxHelp on other platforms).


wxHelpInstance::~wxHelpInstance

Destroys the help instance, closing down wxHelp for this application if it is running.


wxHelpInstance::Initialize

void Initialize(char *file, int server = -1)

Initializes the help instance with a help filename, and optionally a server (socket) number (one is chosen at random if this parameter is omitted). Does not invoke wxHelp. This must be called directly after the help instance object is created and before any attempts to communicate with wxHelp.

You may omit the file extension, and in fact this is recommended if you wish to support .xlp files under X and .hlp under Windows.


wxHelpInstance::DisplayBlock

Bool DisplayBlock(long blockNo)

If wxHelp is not running, runs wxHelp and displays the file at the given block number. If using Windows Help, displays the file at the given context number.


wxHelpInstance::DisplayContents

Bool DisplayContents(void)

If wxHelp is not running, runs wxHelp (or Windows Help) and displays the contents (the first section of the file).


wxHelpInstance::DisplaySection

Bool DisplaySection(int sectionNo)

If wxHelp is not running, runs wxHelp and displays the given section. Sections are numbered starting from 1, and section numbers may be viewed by running wxHelp in edit mode.


wxHelpInstance::KeywordSearch

Bool KeywordSearch(char *keyWord)

If wxHelp (or Windows Help) is not running, runs wxHelp (or Windows Help), and searches for sections matching the given keyword. If one match is found, the file is displayed at this section. If more than one match is found, the Search dialog is displayed with the matches (wxHelp) or the first topic is displayed (Windows Help).


wxHelpInstance::LoadFile

Bool LoadFile(char *file = NULL)

If wxHelp (or Windows Help) is not running, runs wxHelp (or Windows Help), and loads the given file. If the filename is not supplied or is NULL, the file specified in Initialize is used. If wxHelp is already displaying the specified file, it will not be reloaded. This member function may be used before each display call in case the user has opened another file.


wxHelpInstance::OnQuit

Bool OnQuit(void)

Overridable member called when this application's wxHelp is quit (no effect if Windows Help is being used instead).


wxHelpInstance::Quit

Bool Quit(void)

If wxHelp is running, quits wxHelp by disconnecting (no effect for Windows Help).