The following selections are available from the Toolbox.
Symbol | Control Added to Dialog | ||||
Sample | Name | Description |
Pointer | When depressed, the mouse pointer appears as an arrow, and no control is currently selected. | |||
Text | A text control is used to display a text label. | |||
Edit field | An edit field is a rectangle in which a user can enter text. | |||
Group box | A group box is a frame with a text label in its top edge that is used to visually group controls. Group boxes should be ordered before their controls are ordered (see the Order/Group command, p. 49). | |||
Push button | A push button is a rectangle with rounded corners containing a text label. Clicking it with the mouse causes an application-defined action to occur. | |||
Check box | A check box is a square with a text label to the right. Clicking the square or the text checks or unchecks the control. | |||
Radio button | A radio button is a small circle with a text label to the right. It is normally used for a group in which only one item at a time may be selected. Clicking the circle or text selects the button. | |||
Combo box | A combo box is a combination of an edit field and list box. With it, the user can select an item from a list and place the text of that item into the edit field. | |||
List box | A list box control is a rectangle with a vertical scroll bar on its right side. It displays a list of strings, such as file names. | |||
Horizontal scroll bar | A horizontal scroll bar has a scrolling arrow at each end and a slider that can be set to any point in the bar. With it, the user can scroll a window's contents horizontally. | |||
Vertical scroll bar, A vertical scroll bar allows the user to scroll a window's contents vertically. | ||||
Frame | A frame is a simple hollow graphic rectangle. | |||
Rectangle | A rectangle is a simple graphic figure filled with a color. You can flatten a rectangle into a line or bar useful for separating controls. | |||
Icon | An icon control is represented by a sample icon when you are building the dialog. For more information, see the next section. | |||
Custom | A custom control that is specific to an application can be added to the current dialog. For more information on custom controls, see pages 27 and 45. |
The size of the icon is determined by the size of the icon resource with which the icon control is associated. The icon itself is defined in an icon (.ICO) file that you can create using the Image Editor. When you select the icon control, the Properties Bar changes, and the Text field is replaced by an Icon Sym. field with an associated edit field to the right.
As with the dialog itself, there are three identifiers that can be entered in these two edit fields: a resource ID, a symbolic name, and a resource name.
A resource ID is an integer value. The Dialog Editor places a default resource ID value in the right field when you create the icon control.
·To associate a symbolic name with the resource ID:
Enter it in the Icon Sym. edit field.
The resource name, which is a zero-terminated string, is an alternative way of identifying a resource.
·To enter a resource name:
1.Enter it into the Icon Sym. combo box field.
2.Tab to the right-hand field.
3.Delete the ID number.
4.Press ENTER.
If you are writing your own application, you'll find it most simple to standardize resource IDs and associated symbolic names.
In Windows, you can create unique and powerful custom controls that are specific to your application, yet still very much a part of the Windows way of doing things. The buttons in the Dialog Editor's Toolbox are implemented as custom controls. A regular push button pops up when the mouse pointer leaves it, but the Toolbox's custom control stays down.
Before designing a custom control, consider the flexibility offered by an owner-draw button. An owner-draw button behaves like a standard push button, check box, radio button, or group box, but it can have a customized appearance.
When you drop a custom control in your dialog, it appears as a gray rectangle. You can enter text for the control in the Properties Bar Text field. You won't see the actual control until you compile your application.
When you design a custom control, you are responsible for creating a window class and a window procedure for that class in your code.
The window procedure is responsible for handling all of the control's messages. The procedure initializes the control and redraws it when necessary. For more on window procedures and classes, see C for Windows.
In the editor, you make a link to the custom control's implementation in your code by double clicking on the control to open its Styles dialog. For more information, see “Custom Control Styles” on page 45.