When creating child controls for your dialogs, you are free to use almost any control style permitted by Windows. These styles mostly start with the %WS_ prefix (Window Style), and are included in the WIN32API.INC file included in your WINAPI directory.
If the style parameter in your CONTROL ADD statements is set to 0, DDT will set default styles automatically for you. The default styles will depend on the type of control you are adding to your dialog. For example, a button will be given the %WS_TABSTOP style.
Note that DDT always gives your controls certain styles, such as %WS_CHILD and %WS_VISIBLE, regardless of the styles you specify. When setting your style parameter, you can safely ignore these two styles and concentrate on the more important styles that are required. This has the advantage of reducing the clutter of your code. The exception is custom controls - in this case you must explicitly specify all required styles.
The "tab-order" of controls (also known as the "z-order") is determined by the order that DDT controls are created at run-time. That is, the first control added to a dialog is the first control in the z-order, the second control added is second, and so forth. When a dialog is initially displayed, keyboard focus is automatically given to the first control in the z-order that has the %WS_TABSTOP style. Each time the TAB key is subsequently pressed, the keyboard focus moves to the next control in the tab-order. To ensure all controls in a dialog can be selected using the TAB key, each control in the dialog should include the %WS_TABSTOP style. The z-order also determines the order that controls are drawn on a dialog, to help ensure that control that overlap one another can be drawn in a predictable manner.
Controls that are disabled (because either they have the %WS_DISABLED style or they have been dynamically disabled with CONTROL DISABLE) are skipped over.
Most DDT controls are created with the %WS_TABSTOP style by default. However, you should explicitly include the %WS_TABSTOP style in the control style parameter, if your DDT code creates controls with custom (non-default) styles. If you do not include this style, these control(s) may not be able to receive keyboard focus.
The following table lists the default DDT styles for many of the standard controls:
Control type |
Default DDT Styles * |
Hex Value |
%WS_TABSTOP |
50010000 | |
%WS_TABSTOP, {%BS_AUTO3STATE} |
50010006 | |
%WS_TABSTOP, {%BS_AUTOCHECKBOX} |
50010003 | |
%WS_TABSTOP, %CBS_SORT, %CBS_DROPDOWN, {%CBS_HASSTRINGS} |
50010302 | |
%BS_LEFT, {%BS_TOP, %BS_GROUPBOX} |
50000507 | |
%WS_CHILD, %WS_VISIBLE, %SS_OWNERDRAW |
5001000D | |
either {%SS_ICON} or {%SS_BITMAP} |
50000003 5000000E | |
either {%SS_ICON} or {%SS_BITMAP} |
50000003 5000000E | |
either %WS_TABSTOP, {%BS_ICON} or %WS_TABSTOP, {%BS_BITMAP} |
50010040 50010080 | |
either %WS_TABSTOP, {%BS_ICON} or %WS_TABSTOP, {%BS_BITMAP} |
50010040 50010080 | |
%SS_LEFT |
50000000 | |
%SS_ETCHEDFRAME |
50000012 | |
%WS_TABSTOP, %LBS_SORT, %LBS_NOTIFY, %WS_VSCROLL |
50210003 | |
%WS_TABSTOP, %LVS_REPORT, %LVS_SHOWSELALWAYS |
50000009 | |
%WS_TABSTOP, {%BS_AUTORADIOBUTTON} |
50010009 | |
%WS_BORDER |
50800000 | |
either {%SBS_HORZ} or {%SBS_VERT} |
50000000 50000001 | |
%CCS_BOTTOM |
50000003 | |
%WS_CHILD, %WS_TABSTOP |
54010000 | |
%WS_TABSTOP, %WS_BORDER, %ES_AUTOHSCROLL, %ES_LEFT |
50810080 | |
%WS_CHILD, %WS_VISIBLE, %WS_BORDER, %CCS_TOP, and %TB_FLAT |
50808801 | |
%WS_TABSTOP, %TVS_HASBUTTONS, %TVS_HASLINESATROOT, %TVS_HASLINES, and %TVS_SHOWSELALWAYS |
50010027 | |
No default style (%WS_CHILD and %WS_VISIBLE not used)** |
0 |
See Also