wxRuby Documentation Home

Wx::HelpController

This is a family of classes by which applications invoke a viewer to provide on-line help. A help controller allows an application to display help, at the index page or on a particular topic, and shut the help program down on termination. This avoids proliferation of many instances of the help viewer whenever the user requests a different topics via the application’s menus or buttons.

Typically, an application will create a help controller instance when it starts, and immediately call load_file to load the help content from a file. The help viewer will only get run, however, just before the first call to display something.

Using this class will invoke the most appropriate help viewer on each different platform, using the native help controller where possible. This means:

These two classes are very similar in functionality and appearance. Unless you have a strong preference for using the native help viewer on Windows, it’s recommended that you use HtmlHelpController directly, rather than using this class. This has the additional advantage that you only need to provide help files in one format (.htb) to cover all desktop platforms, instead of needing to provide a format (.chm) specially for windows. See HtmlHelpController for more details on the file formats used.

WxWidgets also provides classes for viewing help on Win CE, but WxRuby is not currently ported to this platform.

Derived from

Wx::Object

See also

HtmlHelpController

Class Methods

Instance Methods

Class Methods

HtmlHelpController.instance

HelpController.instance()

Returns a new HelpController if one hasn’t already been created, or returns the previously created one if there is such.

Users typically expect only a single help window to be running for any particular application, with the help shown and hidden as required. To avoid showing multiple help windows within a single application, use this method in preference to new .

HelpController.new

HelpController.new()

Constructor.

Instance Methods

HelpController#init

init(String file)

Initializes the help instance with a help filename. Does not invoke the help viewer. This must be called directly after the help instance object is created and before any attempts to communicate with the viewer.

You may omit the file extension and a suitable one will be chosen. For HtmlHelpController, the extensions zip, htb and hhp will be appended while searching for a suitable file. For WinHelp, the hlp extension is appended.

HelpController#display_block

Boolean display_block(Integer blockNo)

If the help viewer is not running, runs it and displays the file at the given block number.

WinHelp: Refers to the context number.

MS HTML Help: Refers to the context number.

External HTML help: the same as for HelpController#display_section.

HtmlHelpController: sectionNo is an identifier as specified in the .hhc file. See Help files format.

This function is for backward compatibility only, and applications should use HelpController instead.

HelpController#display_contents

Boolean display_contents()

If the help viewer is not running, runs it and displays the contents.

HelpController#display_context_popup

Boolean display_context_popup(Integer contextId)

Displays the section as a popup window using a context id.

Returns false if unsuccessful or not implemented.

HelpController#display_section

Boolean display_section(String section)

If the help viewer is not running, runs it and displays the given section.

The interpretation of section differs between help viewers. For most viewers, this call is equivalent to KeywordSearch. For MS HTML Help, HTML help and external HTML help, if section has a .htm or .html extension, that HTML file will be displayed; otherwise a keyword search is done.

Boolean display_section(Integer sectionNo)

If the help viewer is not running, runs it and displays the given section.

WinHelp, MS HTML Help sectionNo is a context id.

External HTML help: ExtHelpController implements sectionNo as an id in a map file, which is of the form:

0  wx.html             ; Index
1  wx34.html#classref  ; Class reference
2  wx204.html          ; Function reference

HtmlHelpController: sectionNo is an identifier as specified in the .hhc file. See Help files format.

See also the help sample for notes on how to specify section numbers for various help file formats.

HelpController#display_text_popup

Boolean display_text_popup(String text,  Point pos)

Displays the text in a popup window, if possible.

Returns false if unsuccessful or not implemented.

HelpController#get_frame_parameters

Frame get_frame_parameters(Size size = nil,  Point pos = nil, 
                             Boolean newFrameEachTime = nil)

HtmlHelpController returns the frame, size and position.

For all other help controllers, this function does nothing and just returns NULL.

Parameters

HelpController#get_parent_window

Boolean get_parent_window()

Returns the window to be used as the parent for the help window. This window is used by CHMHelpController, WinHelpController and HtmlHelpController.

HelpController#keyword_search

Boolean keyword_search(String keyWord, 
                       HelpSearchMode mode = HELP_SEARCH_ALL)

If the help viewer is not running, runs it, and searches for sections matching the given keyword. If one match is found, the file is displayed at this section. The optional parameter allows the search the index (HELP_SEARCH_INDEX) but this currently only supported by the HtmlHelpController.

WinHelp, MS HTML Help: If more than one match is found, the first topic is displayed.

External HTML help, simple HTML help: If more than one match is found, a choice of topics is displayed.

HtmlHelpController: see HtmlHelpController#keyword_search.

HelpController#load_file

Boolean load_file(String file = "")

If the help viewer is not running, runs it and loads the given file. If the filename is not supplied or is empty, the file specified in Initialize is used. If the viewer 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.

HtmlHelpController ignores this call.

HelpController#on_quit

Boolean on_quit()

Overridable member called when this application’s viewer is quit by the user.

This does not work for all help controllers.

HelpController#set_frame_parameters

set_frame_parameters(String title,  Size size, 
                     Point pos = DEFAULT_POSITION, 
                     Boolean newFrameEachTime = false)

For HtmlHelpController, the title is set (again with \%s indicating the page title) and also the size and position of the frame if the frame is already open. newFrameEachTime is ignored.

For all other help controllers this function has no effect.

HelpController#set_parent_window

set_parent_window(Window parentWindow)

Sets the window to be used as the parent for the help window. This is used by CHMHelpController, WinHelpController and HtmlHelpController.

HelpController#set_viewer

set_viewer(String viewer,  Integer flags)

Sets detailed viewer information. So far this is only relevant to ExtHelpController.

Some examples of usage:

m_help.SetViewer("kdehelp");
m_help.SetViewer("gnome-help-browser");
m_help.SetViewer("netscape", HELP_NETSCAPE);

HelpController#quit

Boolean quit()

If the viewer is running, quits it by disconnecting.

For Windows Help, the viewer will only close if no other application is using it.

[This page automatically generated from the Textile source at Wed Sep 09 02:21:11 +0100 2009]