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

# TCustomListBox.OnMeasureItem

Handler invoked when the height for an item is needed.

## Declaration

Source position: stdctrls.pp line 658

`public property TCustomListBox.OnMeasureItem : TMeasureItemEvent read FOnMeasureItem write FOnMeasureItem;`

## Description

OnMeasureItem is a TMeasureItemEvent property with the event handler signalled to get the height for specified item in the list box control. OnMeasureItem is signalled (when assigned) from the MeasureItem method, and occurs when the LM_MeasureItem message is handled for the control. MeasureItem provides the arguments passed to the event handler, while the message handler stores the calculated height in ItemHeight when it is not 0 (zero).

An application must implement an object procedure to respond to the event notification. Index contains the position in Items with the string to examine in the event handler. On entry, TheHeight contains the text height for the current Font calculated using the Canvas in the control. The value in TheHeight can be updated with the value derived in the event handler.

## See also

TCustomListBox.MeasureItem |  | Gets the height for an item in the list.
TCustomListBox.ItemHeight |  | The default height for an item displayed in the list.
TCustomListBox.Style |  | Appearance of the list box (standard, owner-draw fixed, or owner-draw variable).
TCustomListBox.Font |  | The font to be used for text display in this control.
TCustomListBox.Canvas |  | Drawing surface where the control is drawn.
TMeasureItemEvent |  | Specifies an event handler used to get the Height for a single item in an owner-drawn list box or combo-box.