Adding a Dialog Box
Scribble: MDI Drawing Application, Lesson 7
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.
Note You can find a finished example of this lesson's code in the Scribble Step3 sample source code directory.
Suggested Reading
In Lesson 5, Constructing the User Interface, and Lesson 6, Binding Visual Objects to Code Using WizardBar, you added new commands to Scribble in two steps:
Using the menu editor to add new menu items
Using WizardBar to define message handlers and bind them to the menu commands.
You added menu items for three new commands: Edit Clear All, Thick Pen, and Pen Widths. You practiced binding only the first two of these commands.
The Pen Widths command is somewhat different from the other two commands. Both the Edit Clear All and Thick Pen commands execute to completion as soon as the user clicks them. By contrast, the Pen Widths command requires more information from the user. This command opens a dialog box, one that lets the user specify the widths of the Thin Pen and the Thick Pen.
Before you can write a message handler for the Pen Widths command, you must design the dialog box that it displays and define a new class to manage the dialog box. That’s what you’ll do in this lesson.
This lesson develops a modal dialog box using the same general procedure that was used for adding menu commands in Constructing the User Interface and Binding Visual Objects to Code Using Wizard Bar. You’ll use the dialog editor to design the dialog box’s appearance, and then use ClassWizard to declare a dialog class, and WizardBar to define message handlers and bind them to the dialog box.
This lesson includes the following topics:
Opening the dialog box from your application