O'Reilly logo

Ivor Horton's Beginning Visual C++® 2010 by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Working with Dialogs and Controls

WHAT YOU WILL LEARN IN THIS CHAPTER

  • How to create dialog resources

  • How to add controls to a dialog

  • The basic varieties of controls available

  • 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 to add a status bar to an application

Dialogs and controls are basic tools for user communication in the Windows environment. In this chapter you'll learn how to implement dialogs and controls by applying them to extend the Sketcher program.

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.

There are two things needed to create and display a dialog box in an MFC program: the physical appearance of the dialog box, which is defined in a resource file, and a dialog class object, used to manage the operation of the dialog and its controls. MFC provides a class called CDialog ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required