The Win32 API provides two types of list boxes: single-selection, which is the default, and multiple-selection. In a single-selection list box, the user can select only one item at a time. In a multiple-selection list box, the user can select more than one item at a time. To create a multiple-selection list box, specify the LBS_MULTIPLESEL or the LBS_EXTENDEDSEL style.
Note Windows CE supports the LBS_EX_CONSTSTRINGDATA style which saves RAM resources when you have a large table of strings in ROM that you want to insert into a list box.
All list boxes in Windows CE have the LBS_HASSTRINGS style by default.
List box styles supported by Windows CE are described in the following table.
Style | Description |
---|---|
LBS_DISABLENOSCROLL | Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If you do not specify this style, the scroll bar is hidden when the list box does not contain enough items. |
LBS_EXTENDEDSEL | Allows the user to select multiple items by using the SHIFT key and the mouse or special key combinations. |
LBS_MULTICOLUMN | Specifies a multicolumn list box that the user scrolls horizontally. You set the width of the columns by using the LB_SETCOLUMNWIDTH message. |
LBS_MULTIPLESEL | Turns string selection on or off each time a user clicks or double-clicks a string in the list box. A user can select any number of strings simultaneously. |
LBS_NOINTEGRALHEIGHT | Specifies that the list box will be exactly the size specified by the application when it created the list box. Usually, Windows sizes a list box so that it does not display partial items. |
LBS_NOREDRAW | Specifies that the list box's appearance is not automatically updated when changes are made. You can change this style by sending a WM_SETREDRAW message. |
LBS_NOSEL | Specifies that the user can view list box strings but cannot select them. |
LBS_NOTIFY | Notifies the parent window whenever the user clicks or double-clicks a string in the list box. |
LBS_SORT | Sorts strings in the list box alphabetically. |
LBS_STANDARD | Sorts strings in the list box alphabetically. The parent window receives an input message whenever the user clicks or double-clicks a string. The list box has borders on all sides. |
LBS_USETABSTOPS | Enables a list box to recognize and expand tab characters when drawing its strings. The default tab positions are 32 dialog box units. A dialog box unit is equal to one-fourth of the current dialog box base-width unit. Windows CE calculates these units based on the height and width of the current system font. |
LBS_WANTKEYBOARDINPUT | Specifies that the owner of the list box receives WM_VKEYTOITEM messages whenever the user presses a key and the list box has the input focus. This enables an application to perform special processing on the keyboard input. |
WS_TABSTOP | Turns control into a tab stop, which allows the user to select the control by tabbing through the controls in a dialog box |
Windows CE supports the LBS_NODATA style for compatibility with applications written for earlier versions of Windows.