ITreeControl.GetItemAt

Syntax

GetItemAt(Pt: IPoint; [FullRow: Boolean = False]): ITreeListNode;

Parameters

Pt. The point, at which component element must be obtained.

FullRow. The area, which is checked if it contains an element.

Description

The GetItemAt method checks if there is an element in the specified point of client component area.

Comments

If the Pt point is in the element area, the method returns parameters of this element, otherwise the method returns Null.

The FullRow parameter is set to False by default, the element area is considered to be only the area with the icon and element text (text in all columns, if the ShowColumnHeaders property is set to True).

If the FullRow property is set to True, the element area is considered to be the whole string where it is located: indent area and expander area, state icon, icon, element text (text in all columns) and free area to the right from the text.

NOTE. The GetItemAt method is not supported by the TreeCombo, MetabaseTreeCombo components that inherit from the ITreeControl component.

Example

Executing the example requires a form and the TreeList component named TreeList1 on it. The specified procedure is set as the OnMouseMove event handler for the TreeList1 component.

Sub TreeList1OnMouseMove(Sender: Object; Args: IMouseEventArgs);
Var
    Node: ITreeListNode;
Begin
    Node := TreeList1.GetItemAt(Args.pPoint, True);
    If Node <> Null Then
        Self.Text := Node.Text + '(' + Node.Selected.ToString + ')';
    End If;
End Sub TreeList1OnMouseMove;

On executing the example the mouse cursor position is traced in the TreeList1 component area. If the cursor is over the string with the component, the element text and the attribute indicating the selection are displayed in form title.

See also:

ITreeControl