ITreeControl.OnGetNodeStateImage

Syntax

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

Begin

//set of operators;

End Sub OnGetNodeStateImage;

Parameters

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

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

Description

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

Comments

The event is relevant only if the StateImages property is determined for the component.

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

Using the OnGetNodeStateImage event enables the user to trace changes and, if a certain event occurs, to get or to change element tree state 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 the event argument provides state image index that is set for the element. If a new value for the Result property is set, it is possible to change state image for the element.

Example

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

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

When the event occurs, element selection is checked. If the element is selected, the first image from image collection will be used for state image. If the element is not selected, the second state image is set.

See also:

ITreeControl