Chapter 17. Working with Dialogs and Controls

Dialogs and controls are basic tools for user communications in the Windows environment. In this chapter, you'll learn how to implement dialogs and controls by applying them to extend the Sketcher program. As you do so, you'll learn about:

  • Dialogs and how you can create dialog resources

  • Controls and how to add them to a dialog

  • Basic varieties of controls available to you

  • How to create a dialog class to manage a dialog

  • How to program the creation of a dialog box and how to get information back from the controls in it

  • Modal and modeless dialogs

  • How to implement and use direct data exchange and validation with controls

  • How to implement view scaling

  • How you can add a status bar to an application

Understanding Dialogs

Of course, dialog boxes are not new to you. Most Windows programs of consequence use dialogs to manage some of their data input. You click a menu item and up pops a dialog box with various controls that you use for entering information. Just about everything that appears in a dialog box is a control. A dialog box is actually a window and, in fact, each of the controls in a dialog is also a specialized window. Come to think of it, most things you see on the screen under Windows are windows.

Although controls have a particular association with dialog boxes, you can also create and use them in other windows if you want to. A typical dialog box is illustrated in Figure 17-1.

Figure 17.1. Figure 17-1

This is the File > Open > File dialog in Visual ...

Get Ivor Horton's Beginning Visual C++®2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.