ITreeControl.OnGetNodeImage

Syntax

Sub OnGetNodeImage(Sender: Object; Args: ITreeNodeGetImageEventArgs);

Begin

//set of operators;

End Sub OnGetNodeImage;

Parameters

Sender. Parameter that returns the component that has generated the event.

Args. Parameter that enables the user to determine event parameters.

Description

The OnGetNodeImage event is used on determining the image near the tree element.

Comments

The event is relevant only if the Images property is set for the component.

The event occurs for each tree element in the following cases:

Using the OnGetNodeImage event enables the user to trace changes and, if a certain event occurs, to get of change element tree image. The element, for which the current event is generated, is available in the Node property of the Args event argument. The Result property of event argument can be used to get index of the image that is set for element. If a new value is specified for the Result property, element image can be changed.

Example

Executing the example requires a form with the TreeList component named TreeList1 on it and any ImageList component that is the image source for TreeList1. At least two images are loaded to ImageList.

Sub TreeList1OnGetNodeImage(Sender: Object; Args: ITreeNodeGetImageEventArgs);
Begin
    If Args.Node.Selected Then
        Args.Result := 0;
    Else
        Args.Result := 1;
    End If;
End Sub TreeList1OnGetNodeImage;

When the event occurs, element selection is checked. If element is selected, the first image from image collection is used as its image. If element is not selected, the second image is set for it.

See also:

ITreeControl