Adding Context-Sensitive Help

Scribble: MDI Drawing Application, Lesson 10

Tip   If you prefer working from a printed tutorial, see in MSDN Library Help for details about printing a lesson, a set of topics, or a single topic.

Suggested Reading

  • , Visual C++ Programmer’s Guide

  • , Visual C++ Programmer’s Guide

  • , Visual C++ Programmer’s Guide

  • , Microsoft Foundation Class Reference

So far, thanks to the Microsoft Foundation Class Library (MFC), Scribble implements a number of common user-interface features, such as print preview and splitter windows. This lesson adds another such feature to Scribble: context-sensitive Windows Help.

Scribble already offers the user some help in the form of prompt strings and tool tips. When the user navigates through a menu by using the UP ARROW and DOWN ARROW keys, or uses the mouse to point to a toolbar button, Scribble displays a brief description of the command’s purpose in the status bar (if the status bar is visible). In addition, if the user holds the mouse cursor over a toolbar button, a small pop-up window (called a “tool tip”) appears with a brief description of the button.

Because prompts are attached to command IDs, Scribble’s toolbar buttons, which duplicate commands on the menus, automatically invoke the appropriate prompts.

The framework supplies this level of information for commands predefined by the class library. And, as you did in Lesson 5, in Add the Clear All Command to Scribble’s Edit Menu, you can add prompt strings and tool tips to the menu items you create by filling in a field in the menu’s property page.

The level of help described in this lesson, however, goes much further. By the end of this lesson, which covers Step 6 of Scribble, Scribble provides access to Windows Help from the Help menu, and to context-sensitive Help by pressing the F1 key or SHIFT+F1. When the user chooses the Help menu item, the Help file for Scribble opens, displaying the Help contents screen. Context-sensitive help invokes a Help topic specific to the area of the user interface with focus when F1 or SHIFT+F1 is pressed.