[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'StdCtrls' (#lcl)

# TCustomComboBox.OnMeasureItem

Handler invoked when the height for an item is needed.

## Declaration

Source position: stdctrls.pp line 402

`protected property TCustomComboBox.OnMeasureItem : TMeasureItemEvent read FOnMeasureItem write FOnMeasureItem;`

## Description

OnMeasureItem is a TMeasureItemEvent property with the event handler signalled to get the height for an item displayed in the list box for the control.

OnMeasureItem is signalled (when assigned) from the MeasureItem method. MeasureItem (and OnMeasureItem) are used when the Style property indicates that the control uses a variable height for each item displayed in the list box. OnMeasureItem occurs when the LM_MeasureItem message is handled for the control.

Use the Index argument to get the value in Items examined in the event handler. Use ItemWidth to determine the maximum width allowed for the variable height item. Canvas can be used to get text metrics for the Font used in the control. Update the AHeight argument with the height calculated for the item.

Use ItemHeight for the item height used for fixed height drawing styles.

## See also

TCustomComboBox.MeasureItem |  | Gets the height for an item in the drop-down list.
TCustomComboBox.Style |  | Controls the appearance and behavior for the combo-box.
TCustomComboBox.ItemHeight |  | The default height of an item in the drop-down for the control.
TCustomComboBox.ItemWidth |  | The minimum width of the items in the drop-down list.
TCustomComboBox.Canvas |  | Provides access to the drawing surface for the control.
TMeasureItemEvent |  | Specifies an event handler used to get the Height for a single item in an owner-drawn list box or combo-box.