Vcl.StdCtrls.TListBoxStyle

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

TListBoxStyle = (lbStandard, lbOwnerDrawFixed, lbOwnerDrawVariable, lbVirtual, lbVirtualOwnerDraw);

C++

enum DECLSPEC_DENUM TListBoxStyle : unsigned char { lbStandard, lbOwnerDrawFixed, lbOwnerDrawVariable, lbVirtual, lbVirtualOwnerDraw };

Properties

Type Visibility Source Unit Parent
enum public
Vcl.StdCtrls.pas
Vcl.StdCtrls.hpp
Vcl.StdCtrls Vcl.StdCtrls

Description

TListBoxStyle specifies the way a listbox control gets its data and how it is drawn.

The following table lists the values for the TListBoxStyle type:



Value Meaning

lbStandard

All items are strings, with each item the same height.

lbOwnerDrawFixed

The list box is owner-drawn, but each item in the list box is the height specified by the ItemHeight property. Each time an item is displayed in an lbOwnerDrawFixed list box, the OnDrawItem event occurs. The event handler for OnDrawItem draws the specified item. The ItemHeight property determines the height of each of the items.

lbOwnerDrawVariable

The list box is owner-drawn, and items in the list box can be of varying heights. Each time an item is displayed in an lbOwnerDrawVariable list box, two events occur. The first is the OnMeasureItem event. The code for the OnMeasureItem handler can set the height of each item. Then the OnDrawItem event occurs. The code for the OnDrawItem handler draws each item in the list box using the size specified by the OnMeasureItem handler.

lbVirtual

The list box is virtual, but all items are strings with the same height. You must indicate the number of items in the list box by setting the Count property. You must supply the items in the list box using an OnData event handler. If the items have associated objects, you must supply them using an OnDataObject event handler. In addition, you must supply an OnDataFind event handler to provide the mapping from the strings in the list box to their indexes.

lbVirtualOwnerDraw

The list box is virtual and owner-drawn. All items are the same height. As with lbOwnerDrawFixed, the item height is specified by the ItemHeight property, and you must draw items using an OnDrawItem event handler. As with lbVirtual, you must set the Count property and supply OnData and OnDataFind event handlers to provide the mapping between items and indexes. If items are associated with objects, you must also supply an OnDataObject event handler.