Providing online help for users

Two ways to call help from an application

PowerBuilder provides two principal ways of calling an online help file from a PowerBuilder application:

  • Use the ShowHelp and ShowPopupHelp PowerScript functions in your application scripts to call help topics.

  • Declare the HTML Help API as an external function and use the HTMLHelp function in your application scripts to call help topics.

Using ShowHelp

ShowHelp is simpler to implement than the HTML Help API. You can use the ShowHelp PowerScript function to search for help topics by help context ID, by keyword, and by accessing the help file Contents topic (the topic defined in the project file as the Help Contents topic). ShowHelp can also be used with compiled WinHelp (.hlp) files.

ShowPopupHelp displays pop-up help for a control. Typically, you use ShowPopupHelp in the Help event of a response window with the Context Help property enabled. Events relating to movement of the cursor over a control or to the dragging of a control or object are also logical places for a ShowPopupHelp call.

For more information on the ShowHelp and ShowPopupHelp functions as well as the Help event, see the section called “ShowHelp” in PowerScript Reference, the section called “ShowPopupHelp” in PowerScript Reference, the section called “Help” in PowerScript Reference.

Using the HTML Help API

Declaring and using the HTML Help API allows access to the full range of HTMLHelp functions, many of which are not available in ShowHelp. For example, using the HTMLHelp function, you can easily specify a window type or window name in which to present a help topic.

To declare the HTML Help API as an external function:

  1. Select Declare>Global External Functions from the menu bar of any painter that accesses the Script view.

  2. Enter the function declaration in the text box and click OK.

    This example declares the HTML Help API:

    FUNCTION long HtmlHelpW(long hWndMain, &
           string lpszHelp, long uCommand, &
           long dwData) &
    LIBRARY "hhctrl.ocx"

For more information about the HTML Help API, see the online help for the Microsoft Help Workshop or the documentation for your help authoring tool. For more information about declaring and using global external functions, see the section called “Declaring external functions” in PowerScript Reference and Using external functions.