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

# TCustomTreeView.OnGetImageIndex

Event handler signalled to get the ordinal position for the image displayed on a tree node.

## Declaration

Source position: comctrls.pp line 3684

`protected property TCustomTreeView.OnGetImageIndex : TTVExpandedEvent read FOnGetImageIndex write FOnGetImageIndex;`

## Description

OnGetImageIndex is a TTVExpandedEvent property with the event handler signalled to get the index for an image displayed on a tree node. The index is an ordinal position in the Images assigned for the control. OnGetImageIndex allows a value assigned to the ImageIndex property in the tree node to be overridden, or set to a default value.

OnGetImageIndex is signalled (when assigned) from the DoPaintNode method. It occurs when the Icon for a node is drawn using the Images for the tree view control. It is not a signalled if Images has not been assigned (contains Nil).

Arguments to the event handler include:

Sender
  The object instance (TCustomTreeView) for the event.
Node
  The TTreeNode instance examined in the handler routine.

The handler routine should select and assign a value to the ImageIndex property in Node; there is no way to provide the value as a separate argument or return value.

Use OnGetSelectedIndex to get the image index for the a selected node on the tree view control.

## See also

TCustomTreeview.Images |  | Image list which holds icons for the tree nodes in Items.
TCustomTreeview.DoPaintNode |  | Renders the specified tree node to the canvas for the control.
TCustomTreeview.DoPaint |  | Implements the Paint method for the control.
TCustomTreeview.OnGetSelectedIndex |  | Event handler signalled to get the ordinal position for the image displayed for a selected node on the tree view control.
TTreeNode.ImageIndex |  | Ordinal position for the image displayed for the node, or -1 when no image is assigned.
TTVExpandedEvent |  | TTVExpandedEvent - generic event handling method for a Tree Node that has been expanded.