IDimensionViewer.GetItemAt

Syntax

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

Parameters

Pt. The point, at which component element can 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 index of this element, otherwise the method returns -1.

By default, the FullRow parameter is set to False, an element area is the area that is occupied with an element icon and text (text in all columns if the ShowColumnHeaders property is set to True).

If the FullRow parameter is set to True, an element area is the full row, which contains the parameter: indent and expander area, icon, element text (text in all columns) and free area to the right of the text.

NOTE. The GetItemAt method is not supported by the DimensionCombo component that inherits from the IDimensionViewer interface.

Example

Executing the example requires a form, the DimensionTree component named DimensionTree1 on the form and a data source for DimensionTree1. The specified procedure is set as the OnMouseMove event handler for the DimensionTree1 component.

Sub DimensionTree1OnMouseMove(Sender: Object; Args: IMouseEventArgs);
Var
    DimInst: IDimInstance;
    Node: Integer;
Begin
    Node := DimensionTree1.GetItemAt(Args.pPoint, True);
    If Node > -1 Then
        DimInst := DimensionTree1.Dimension.DimInstance;
        Self.Text := DimInst.Elements.Name(Node);
    End If;
End Sub DimensionTree1OnMouseMove;

On executing the example the mouse cursor position is traced in the DimensionTree1 component area. If the cursor is over the row with the component, the element text is displayed to form title.

See also:

IDimensionViewer