OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Constructing List Box Objects

One of TListBox's constructors takes seven parameters: a parent window, a resource identifier, the control's x, y, h, and w dimensions, and an optional module pointer, as shown in the following syntax statement:

TListBox(TWindow *parent, int resourceId, int x, int y, int w, int h, TModule *module = 0);

TListBox gets the default control styles (WS_CHILD, WS_VISIBLE, WS_GROUP, and WS_TABSTOP) and adds LBS_STANDARD, which is a combination of LBS_NOTIFY (to receive notification messages), WS_VSCROLL (to have a vertical scroll bar), LBS_SORT (to sort the list items alphabetically), and WS_BORDER (to have a border). If you want a different list box style, you can modify Attr.Style in the list box object's constructor or in its parent's constructor.

For example, for a list box that does not sort its items, use the following code:

listbox = new TListBox(this, ID_LISTBOX, 20, 20, 340, 100);
listbox->Attr.Style &= ~LBS_SORT;

See Also