IListView.HitTest

Syntax

HitTest(Pt: IPoint; Var Hit: HitTestResult): IListViewItem;

Parameters

Pt - point, in which the component element can be received.

Hit - parameter that contains additional information.

Description

The HitTest method is an extension of the GetItemAt method. After executing the method the Hit parameter contains additional information.

Example

Sub ListView1OnMouseDown(Sender: Object; Args: IMouseClickEventArgs);

Var

s: string;

Hit: HitTestResult;

LVI: IListViewItem;

Begin

LVI := ListView1.HitTest(Args.pPoint, Hit);

Select Case (Hit As Integer)

Case 1: s := "Nowhere";

Case 2: s := "OnItemIcon";

Case 4: s := "OnItemLabel";

Case 8: s := "OnItemIndent";

Case 16: s := "OnItemButton";

Case 32: s := "OnItemRight";

Case 64: s := "OnItemStateIcon";

Case 256: s := "Above";

Case 512: s := "Below";

Case 2048: s := "ToLeft";

Case 1024: s := "ToRight";

Else s := "OutSide";

End Select;

WinApplication.InformationBox(s);

End Sub ListView1OnMouseDown;

After the mouse button click in the area of the elements of the ListView1 component, the message, that contains the name of the area, in which the mouse cursor is, is displayed.

See also:

IListView