|
List Box Styles
The Win32 API provides two general styles of list box: single-selection (the
default style) 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; an application must
specify either the LBS_MULTIPLESEL or the LBS_EXTENDEDSEL style for a
multiple-selection list box.
The Win32 API provides many other list box and window styles that control the
appearance and operation of a list box. These styles indicate whether list box
items are sorted, arranged in multiple columns, drawn by the application, and
so on. The dimensions and styles of a list box are typically defined in a dialog
box template included in an application's resources. For information about how
to create a dialog box template and include it in an application, see the
documentation provided with your development tools.
To create a list box by using the CreateWindow or CreateWindowEx function, use the LISTBOX class, appropriate window style constants, and the
following style constants to define the list box.
List box 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 multiple items to be selected by using the SHIFT key and the mouse or special key combinations.
| LBS_HASSTRINGS
| Specifies that a list box contains items consisting of strings. The list box
maintains the memory and addresses for the strings so that the application can
use the LB_GETTEXT message to retrieve the text for a particular item. By default, all list
boxes except owner-drawn list boxes have this style. You can create an owner-drawn
list box either with or without this style.
| LBS_MULTICOLUMN
| Specifies a multicolumn list box that is scrolled horizontally. The LB_SETCOLUMNWIDTH message sets the width of the columns.
| LBS_MULTIPLESEL
| Turns string selection on or off each time the user clicks or double-clicks a
string in the list box. The user can select any number of strings.
| LBS_NODATA
| Obsolete.
| LBS_NOINTEGRALHEIGHT
| Specifies that the size of the list box is exactly the size specified by the
application when it created the list box. Normally, Windows sizes a list box so
that the list box does not display partial items.
| LBS_NOREDRAW
| Specifies that the list box's appearance is not updated when changes are made.
You can change this style by sending a WM_SETREDRAW message at any time.
| LBS_NOSEL
| Specifies that the list box contains items that can be viewed but not
selected.
| LBS_NOTIFY
| Notifies the parent window with an input message whenever the user clicks or
double-clicks a string in the list box.
| LBS_OWNERDRAWFIXED
| Specifies that the owner of the list box is responsible for drawing its
contents and that the items in the list box are the same height. The owner window
receives a WM_MEASUREITEM message when the list box is created and a WM_DRAWITEM message when a visual aspect of the list box has changed.
| LBS_OWNERDRAWVARIABLE
| Specifies that the owner of the list box is responsible for drawing its
contents and that the items in the list box are variable in height. The owner window
receives a WM_MEASUREITEM message for each item in the combo box when the combo
box is created and a WM_DRAWITEM message when a visual aspect of the combo box
has changed.
| 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 a
horizontal or vertical distance. One horizontal dialog box unit is equal to
0.25 of the current dialog box base-width unit. Windows calculates these units
based on the height and width of the current system font. The GetDialogBaseUnits function returns the current dialog box base units in pixels.
| 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.
|
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|