Dialog Box Controls
The template specifies the position, width, height, style, identifier, and
window class for each control in the dialog box. Windows creates each control by
passing this data to the
CreateWindowEx function. Controls are created in the order they are given in the template.
The template should specify the appropriate number, type, and order of controls
to ensure that the user can enter the input needed to complete the command
associated with the dialog box.
For each control, the template specifies style values that define the
appearance and operation of the control. Every control is a child window and therefore
must have the WS_CHILD style. To ensure that the control is visible when the
dialog box is displayed, each control must also have the WS_VISIBLE style. Other
commonly used window styles are WS_BORDER for controls that have optional
borders, WS_DISABLED for controls that should be disabled when the dialog box is
initially created, and WS_TABSTOP and WS_GROUP for controls that can be accessed
using the keyboard. The WS_TABSTOP and WS_GROUP styles are used in conjunction
with the dialog keyboard interface described later in this topic.
The template may also specify control styles specific to the control's window
class. For example, a template that specifies a button control must give a
button control style such as BS_PUSHBUTTON or BS_CHECKBOX. Windows passes the
control styles to the control window procedure through the
WM_CREATE message, allowing the procedure to adapt the appearance and operation of the
control.
Windows converts the position coordinates and the width and height
measurements from dialog base units to pixels, before passing these to
CreateWindowEx. When Windows creates a control, it specifies the dialog box as the parent
window. This means Windows always interprets the position coordinates of the
control as client coordinates, relative to the upper left corner of the dialog
box's client area.
The template specifies the window class for each control. A typical dialog box
contains controls belonging to the predefined control window classes, such as
the button and edit control window classes. In this case, the template
specifies window classes by supplying the corresponding predefined atom values for the
classes. When a dialog box contains a control belonging to a custom control
window class, the template gives the name of that registered window class or the
atom value currently associated with the name.
Each control in a dialog box must have a unique identifier to distinguish it
from other controls. Controls send information to the dialog box procedure
through
WM_COMMAND messages, so the control identifiers are essential for the procedure to
determine which control sent a given message. The only exception to this rule are
control identifiers for static controls. Static controls do not require unique
identifiers because they send no WM_COMMAND messages.
To permit the user to close the dialog box, the template should specify at
least one push button and give it the control identifier IDCANCEL. To permit the
user to choose between completing or canceling the command associated with the
dialog box, the template should specify two push buttons, labeled OK and Cancel,
with control identifiers of IDOK and IDCANCEL, respectively.
A template also specifies optional text and creation data for a control. The
text typically provides labels for button controls or specifies the initial
content of a static text control. The creation data is one or more bytes of data
that Windows passes to the control window procedure when creating the control.
Creation data is useful for controls that require more information about their
initial content or style than is given by other data. For example, an application
can use creation data to set the initial setting and range for a scroll bar
control.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database