C++ Course Listing

 

Important Windows Components

by Matthew Martin

Contents

Dialogue Boxes

Dialogue Box Resource

Dialogue Box Class

Dialogue Box Modes

Some Windows Controls

There are a number of important windows components that you need to know about in order to program Windows applications. On of the most important for the Windows application programmer, is the dialogue box.


Dialogue Boxes


Dialogue boxes are used in many Windows applications as a means of getting the user to enter information and to provide information to the user.


Dialogue Box Resource


The dialogue box resource is used to draw the dialogue box and its controls on the screen.


Dialogue Box Class


This holds the values (properties) of the dialog box.


Dialogue Box Modes


Dialogue boxes can be modal or modeless. Most of the dialog boxes you will code will be modal dialog boxes. A modal dialog box is on top of all the other windows in the application: The user must deal with the dialog box and then close it before going on to other work. An example of this is the dialog box that comes up when the user chooses File, Open in any Windows application. A modeless dialog box enables the user to click the underlying application and do some other work and then return to the dialog box. An example of this is the dialog box that comes up when the user chooses Edit, Find in many Windows applications. Usually modal dialogue boxes are used I Windows applications.

top of page


Some Windows Controls


Before looking at dialogue boxes in more detail, some important windows controls that may be used in dialogue boxes are considered. These controls are not just used in dialogue boxes but in many other areas of a Windows application.

Static text: Used to label other controls, such as edit boxes.
Edit box: Single line or multi-line, a place for users to type strings or numbers as input to the program. Read-only edit boxes are used to display text. Variable associated with edit boxes are usually of type: string, int, float, or long. Commonly a string is used.
Button: The design of every dialog box starts with OK and Cancel buttons. Other buttons, in addition to these, can be added.
Check box: This control is used to set options on or off. Each option can be selected or deselected independently. Variables connected to a check box usually are of type int.
Radio button: This control is used to select only one of a number of related options. Selecting one button deselects the rest. Variables connected to a radio button usually are of type int.
List box: This box type is used to select one item from a list hard-coded into the dialog box or filled in by the program as the dialog box is created. The user cannot type in the selection area but has to choose from the list displayed. Variables connected to a list box usually are of type string.
Combo box: A combination of an edit box and a list box (see above). This control allows users to select from a list or type their response. Variables connected to a combo box usually are of type string.

 

by Matthew Martin

top of page