About Control Windows

Control windows are used most often as part of a frame or dialog window, but they also can be used in a client window. An application can create control windows in a frame window by using frame-control flags in the WinCreateStdWindow function, or it can create control windows individually by calling the WinCreateWindow function.

Including control windows in a dialog window requires the use of a dialog template, which is a data structure that describes a dialog window and its control windows. The system uses the data in the dialog template to create the dialog window and control windows. An application can create a dialog template at run time, or it can use the system resource compiler to create a dialog-template resource.

The operating system provides many types of predefined control windows. An application can create a control of a particular type by specifying the appropriate control-window class name, either in the WinCreateWindow function or in a dialog template. The following is a list of the predefined control-window classes:

┌───────────────┬─────────────────────────────────────────────┐
│Class name     │Description                                  │
├───────────────┼─────────────────────────────────────────────┤
│WC_BUTTON      │Consists of buttons and boxes the user can   │
│               │select by clicking the pointing device or    │
│               │using the keyboard.                          │
├───────────────┼─────────────────────────────────────────────┤
│WC_COMBOBOX    │Creates a combination-box control, which     │
│               │combines a list-box control and an           │
│               │entry-field control. It allows the user to   │
│               │enter data by typing in the entry field or   │
│               │choosing from a list in the list box.        │
├───────────────┼─────────────────────────────────────────────┤
│WC_CONTAINER   │Creates a control for the user to group      │
│               │objects in a logical manner.  A container can│
│               │display those objects in various formats or  │
│               │views.  The container control supports drag  │
│               │and drop so the user can place information in│
│               │a container by simply dragging and dropping. │
├───────────────┼─────────────────────────────────────────────┤
│WC_ENTRYFIELD  │Consists of a single line of text that the   │
│               │user can edit.                               │
├───────────────┼─────────────────────────────────────────────┤
│WC_FRAME       │A composite window class that can contain    │
│               │child windows of many of the other window    │
│               │classes.                                     │
├───────────────┼─────────────────────────────────────────────┤
│WC_LISTBOX     │Presents a list of text items from which the │
│               │user can make selections.                    │
├───────────────┼─────────────────────────────────────────────┤
│WC_MENU        │Presents a list of items that can be         │
│               │displayed horizontally as action bars, or    │
│               │vertically as pull-down menus.  Menus usually│
│               │are used to provide a command interface to   │
│               │applications.                                │
├───────────────┼─────────────────────────────────────────────┤
│WC_NOTEBOOK    │Creates a control for the user that is       │
│               │displayed as a number of pages.  The top page│
│               │is visible, and the others are hidden, with  │
│               │their presence being indicated by a visible  │
│               │edge on each of the back pages.              │
├───────────────┼─────────────────────────────────────────────┤
│WC_SCROLLBAR   │Consists of window scroll bars that let the  │
│               │user request to scroll the contents of an    │
│               │associated window.                           │
├───────────────┼─────────────────────────────────────────────┤
│WC_SLIDER      │Creates a control that is usable for         │
│               │producing approximate (analog) values or     │
│               │properties.  Scroll bars were used for this  │
│               │function in the past, but the slider provides│
│               │a more flexible method of achieving the same │
│               │result, with less programming effort.        │
├───────────────┼─────────────────────────────────────────────┤
│WC_SPINBUTTON  │Creates a control that presents itself to the│
│               │user as a scrollable ring of choices, giving │
│               │the user quick access to the data.  The user │
│               │is presented only one item at a time, so the │
│               │spin button should be used with data that is │
│               │intuitively related.                         │
├───────────────┼─────────────────────────────────────────────┤
│WC_STATIC      │Simple display items that do not respond to  │
│               │keyboard or pointing device events.          │
├───────────────┼─────────────────────────────────────────────┤
│WC_TITLEBAR    │Displays the window title or caption and lets│
│               │the user move the window's owner.            │
├───────────────┼─────────────────────────────────────────────┤
│WC_VALUESET    │Creates a control similar in function to the │
│               │radio buttons but provides additional        │
│               │flexibility to display graphical, textual,   │
│               │and numeric formats.  The values set with    │
│               │this control are mutually exclusive.         │
└───────────────┴─────────────────────────────────────────────┘

A control window is always owned by another window, usually a frame or dialog window. This relationship is important because a control window sends WM_CONTROL messages to its owner whenever an input event occurs in the control window. Each WM_CONTROL message includes the identifier of the control window in which the event occurred and a notification code that specifies the nature of the event. An application specifies a control window's ID either in the WinCreateWindow function or in a dialog template. Each ID must be unique.

Control windows are like other predefined window classes in that they respond to standard window-management messages and functions, such as WinSetWindowText and WinShowWindow.

All control-window classes have a set of specific messages they send and receive. The summary at the end of this chapter lists the messages that all control windows have in common.

The system paints most control windows synchronously-that is, it redraws a control window as soon as any part of that window becomes invalid.


[Back: Control Windows]
[Next: Using Control Windows]