Express > Express Assembly Interfaces > ILanerBox > ILanerBox.HitTest
HitTest(X: Integer; Y: Integer): LanerBoxArea;
X. Horizontal coordinate.
Y. Vertical coordinate.
The HitTest method returns component area based on the specified coordinates.
Coordinates are specified relative to the left top corner of the component.
Executing the example requires a form, the LanerBox component named LaneBox1 on the form and the UiErAnalyzer component that is a data source for LanerBox. A workbook of the time series database should be loaded to UiErAnalyzer1. The Memo component named Memo1 is also available on the form.
The specified procedure is a handler of the OnMouseDown event for LanerBox.
Sub LanerBox1OnMouseDown(Sender: Object; Args: IMouseClickEventArgs);
Var
BoxArea: LanerBoxArea;
Point: IPoint;
Begin
Point := Args.pPoint;
BoxArea := LanerBox1.HitTest(Point.X, Point.Y);
Select Case BoxArea
Case LanerBoxArea.None: Memo1.Lines.Add("Area is undefined");
Case LanerBoxArea.MethodsBar: Memo1.Lines.Add("Modeling panel");
Case LanerBoxArea.Toolbar: Memo1.Lines.Add("Toolbar ");
Case LanerBoxArea.Tabsheet: Memo1.Lines.Add("Data table");
Case LanerBoxArea.DimPanel: Memo1.Lines.Add("Dimension panel");
End Select;
End Sub LanerBox1OnMouseDown;
After executing the example, Memo1 shows name of the clicked LanerBox area.
See also: