IBreadcrumb.HitTest

Syntax

HitTest(Point: IPoint): Integer;

Parameters

Point. The point in the area of component, in which the component element should be obtained.

Description

The HitTest method enables the user to receive element of the component in the specified point.

Comments

The method returns a number of element located in the Point point or -1, if the element of the component is not present in the Point point.

Example

Executing the example requires a form and the Breadcrumb component and the PopupMenu component on the form. Several elements are created for Breadcrumb. The PopupMenu component is set as a context menu for the Breadcrumb component.

Sub PopupMenu1OnPopup(Sender: Object; Args: IPopupMenuEventArgs);
Var
    Br: IBreadcrumb;
    Elem: Integer;
Begin
    If Args.Control Is Breadcrumb Then
        Br := Args.Control As IBreadcrumb;
        Elem := Br.HitTest(Args.Point);
        If Elem <> -1 Then
            Debug.WriteLine(Br.Items.Item(Elem).Text);
        End If;
    End If;
End Sub PopupMenu1OnPopup;

After executing the example, if the context menu was opened in the area of any element of the Breadcrumb component, the development environment console displays name of this element.

See also:

IBreadcrumb