Class: cHtmlHelp

Properties  Events  Methods    Index of Classes

Used to provide access to an HTML-based help system

Hierarchy

cObject
---cHtmlHelp

Library: Windows Application Class Library

Package: cHtmlHelp.pkg

Description

The cHtmlHelp class provides support for a Windows application to access an HTML help file. An application can be designed to use HTML help or Windows Help. It is expected that you will want to use HTML help in your applications.

HTML Help is not supported in Web Applications.

Creating Help in Your Application

Help support is standard part of the framework classes. To use help in an application you need to do three things:

1. Use the package Std_help.pkg. This creates global HTML and windows help objects that will be used by the application.

Use Std_Help.pkg

2. Set two properties in your application to determine the help type (HTML or windows) and the help file name. This is done by setting two properties in the cApplication object - psHelpFile peHelpType.

Object oApplication is a cApplication
    Set psCompany to "Data Access Worldwide"
    Set psProduct to "DataFlex 9 Examples"
    Set psVersion to "9.1"
    Set psProgram to "Order"

    Set psHelpFile to "OrderEntry.chm"
    Set peHelpType to htHtmlHelp

    Procedure OnCreate
        Send DoOpenWorkspace CURRENT$WORKSPACE
    End_Procedure

End_Object    // oApplication

3. Assign help context to your objects. You can assign either a help context id (help_id) or a help context keyword (help_keyword). Normally, you will want to use help context Ids. You do not need to assign a help id for each object. If an object does not have a help id (or context keyword) assigned it will delegate to its parent object and attempt to find help context at this level. This process continues until a help id is found or the desktop is encountered. This lets you choose the specificity of your help context ranging from unique help context for every object (unlikely) to no help context at all. If no help context is provided the help system's table of contents is invoked. Often, you will find that you want to provide help at the view or panel level.

Once an object has the appropriate help context it will send the appropriate help message to the HTML help object passing along the context as required. That message will be either DoShowMapId (for context ids), DoDisplayKeyword (for keyword context) or DoDisplayTOC (if no context exists). The help object, will then invoke your help system.

Set Help_Id to CustomerViewHelpId // assume this constant was defined and represents a numeric ID

Accessing the Help Object

When the HTML help object is created, its object handle is assigned to the global variable ghoHtmlHelp. You can use this handle to determine if an HTML help object exists and to send messages to it. Because help is a part of the framework, you will rarely set properties in this object, and rarely send messages to the help object. However, if you do need to send a message to your HTML help object you may do so.

Send DoDisplayTOC of ghoHtmlHelp   // display table of contents

Help and the Application Object

You are strongly encouraged to use the cApplication object to define your help type and help file. An interface is provided in the cHtmlHelp class that sets the help filename (psHelpFile). You should avoid using this property and use the one in the cApplication object.

If you are not using an application object, you must make sure that you manually set the help property phoOwner to the object id of your main application panel. When you use an application object, this property is set for you automatically.

Note:Never invoke help if your main application panel is not yet active. The help system needs to use the window handle of the object as its parent handle.


Note:The HelpSystem class is also part of the framework and is used to provide windows help. Windows Help is obsolete. You are encouraged to build an HTML based help system.