OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Constructing Combo Boxes

TComboBox has two constructors.

The first takes the seven parameters commonly found in a control object constructor (a parent window, a resource identifier, the control's x, y, h, and w dimensions, and an optional module pointer), and also style and maximum text length parameters. This constructor is declared like this:

TComboBox(TWindow *parent, int id, int x, int
y, int w, int h, uint32 style, uint16 textLen, TModule *module = 0);

All combo boxes have the styles WS_CHILD, WS_VISIBLE, WS_GROUP, WS_TABSTOP, CBS_SORT (to sort the list items), CBS_AUTOHSCROLL (to let the user enter more text than fits in the visible edit area), and WS_VSCROLL (vertical scroll bar). The style parameter you supply is one of the Windows combo box styles CBS_SIMPLE, CBS_DROPDOWN, or CBS_DROPDOWNLIST. The text length specifies the maximum number of characters allowed in the edit area.

The second TComboBox constructor lets you create an ObjectWindows object that serves as an alias for an existing combo box. This constructor looks like this:

TComboBox(TWindow* parent,
TModule* module = 0);

The following lines show a typical combo box constructor call, constructing a drop down list combo box with an unsorted list:

Combo1 = new TComboBox(this, ID_COMBO1, 190, 30, 150, 100,
CBS_SIMPLE, 20);
Combo1->Attr.Style &= ~CBS_SORT;

See Also