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

# TCustomTreeView.UpdateDefaultItemHeight

Calculates and updates the value in the DefaultItemHeight property.

## Declaration

Source position: comctrls.pp line 3635

`protected procedure TCustomTreeView.UpdateDefaultItemHeight; virtual;`

## Description

UpdateDefaultItemHeight is a procedure used to calculate and update the value for the DefaultItemHeight property. No actions are performed in the method for the following conditions:

- tvoAutoItemHeight has not been included in the Options for the control.
- The handle for the control has not been allocated.
- The handle for the control Canvas has not been allocated.

The height for the Text in the node is calculated using the TCanvas.TextHeight method, and space is reserved for the default spacing for the tree node.

GetImageSize is called to get the height needed for Images or StateImages used in the control. Values in ImageSize and StateImageSize are updated with the scaled image heights including default spacing. The calculated value is enlarged for the Image sizes if needed.

UpdateDefaultItemHeight updates the States property to include values that indicate the item height for nodes has changed. The Invalidate method is called to redraw the control.

UpdateDefaultItemHeight is called from methods like: InitializeWnd, Loaded, SetOptions, and DoPaint.

## See also

TCustomTreeView.DefaultItemHeight |  | Default height for tree nodes in the control.
TCustomTreeView.Images |  | Image list which holds icons for the tree nodes in Items.
TCustomTreeView.ImagesWidth |  | Width for the Images used in the tree view control.
TCustomTreeView.StateImages |  | Image list with the bitmaps used to represent the state for nodes in the tree.
TCustomTreeView.StateImagesWidth |  | Width for the bitmaps in the StateImages property.
TCustomTreeView.States |  | Contains the state values in effect for the control.