IBreadcrumb.HitTest

Syntax

HitTest(Point: IPoint): Integer;

Parameters

Point - point in the area of component, in which the element of the component should be received.

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, the Breadcrumb component on it and the PopupMenu component. Several elements have been created in the Breadcrumb. The PopupMenu component was 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 name of this element is displayed in the development environment console.

See also:

IBreadcrumb