COMBOBOX Statement

Summary: Syntax

COMBOBOX id, x, y, width, height[[,style]]

This statement defines a combo box belonging to the COMBOBOX class. A combo box consists of either a static text field or edit field combined with a list box. The list box can be displayed at all times or pulled down by the user. If the combo box contains a static text field, the text field always displays the selection (if any) in the list-box portion of the combo box. If it uses an edit field, the user can type in the desired selection; the list box highlights the first item (if any) which matches what the user has entered in the edit field. The user can then select the item highlighted in the list box to complete the choice. In addition, the combo box can be owner-draw and of fixed or variable height.

The id field takes a unique integer value that identifies the control.

The x and y fields take integer values that specify the x and y coordinates of the upper-left corner of the control. The horizontal units are 1/4 of the dialog base width unit; the vertical units are 1/8 of the dialog base height unit. The current dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits function returns the dialog base units in pixels. The coordinates are relative to the origin of the dialog box.

The width and height fields take integer values that specify the width and height of the control. The width units are 1/4 of the dialog base width unit; the height units are 1/8 of the dialog base height unit.

The optional style field can contain any combination (or none) of the following styles:

WS_TABSTOP

WS_GROUP

WS_VSCROLL

WS_DISABLED

These styles are described in the list of window styles following the description of the STYLE statement on page 171.

In addition to these styles, the style field may contain any combination (or none) of the COMBOBOX-class styles described in the list of control styles on page 191. Styles can be combined using the bitwise inclusive OR operator.

Summary: Comments

The x, y, width, and height fields can use the addition operator (+) for relative positioning. For example, 15 + 6 can be used for the x field.

The default style for COMBOBOX is WS_TABSTOP and CBS_SIMPLE.

The following example demonstrates the correct usage of the COMBOBOX statement:

COMBOBOX 777, 10, 10, 50, 54, CBS_SIMPLE | WS_VSCROLL | WS_TABSTOP