Partager via


How to: Add Context Sensitive Help to Applications

Adding context-sensitive Help to applications makes it possible for users to access Help topics related to the tasks they perform or the user interface elements they see in your application. For example, if a user is viewing a data entry form, you can configure context-sensitive Help to provide a Help topic related specifically to the data entry form.

You can choose the level of detail to implement context-sensitive Help in your application. For example, you can associate a context-sensitive Help topic with a form or you can associate more detailed Help topics with each control and field on the form.

Users can access context-sensitive Help typically by pressing the F1 key. F1 is enabled for context-sensitive Help by default.

Note

Though you can map any key to activate context-sensitive Help using the ON KEY LABEL command, pressing the F1 key is a recognized standard for Help; therefore, redefining this key is not recommended. For more information, see ON KEY LABEL Command.

To add context-sensitive Help, you must specify a Help file for your application and then assign specific Help topics to the objects in your application.

Specifying a Help File

To specify a Help file for your application

  • Use the SET HELP command to specify the name of the Help file you want to use.

    Tip

    This command is typically included in the setup code for the main program of your application.

For more information, see SET HELP Command.

For example, the following line of code sets the HTML Help file MyHelp.chm as the Help file to use:

SET HELP TO MyHelp.chm

Assigning Help Topics

You can assign specific Help topics to objects, such as forms, controls, or toolbars, in your application.

To assign a Help topic to an object

  1. At design time, select the object that you want to want to assign a topic.

  2. On the Window menu, click Properties Window.

  3. In the Properties window, set the HelpContextID property to the number associated with the topic in your Help file.

For more information, see HelpContextID Property (Visual FoxPro).

Note

To assign Help topics to menu titles or menu commands, you must include the SET TOPIC command in the procedure associated with the menu title or menu command. For more information, see SET TOPIC Command.

See Also

Tasks

How to: Implement "What's This?" Help

How to: Add Help Buttons to Forms

Other Resources

Configuring Help Files for Applications