ITabView.HitTestCell

Syntax

HitTestCell(X: Integer; Y: Integer; Var Row: Integer; Var Column: Integer);

Parameters

X. X coordinate.

Y. Y coordinate.

Row. The variable in which the row index, containing the point with specified coordinates, is to be located.

Column. The variable in which the column index, containing the point with specified coordinates, is to be located.

Description

The HitTestCell method calculates indexes of the row and the column that contain the table cell containing the point, which coordinates were set as input parameters X and Y.

Comments

These coordinates can be obtained using any table events, the argument of which contains the property pPoint.

Calculated values are saved to variables passed as the Row and Column parameters.

Example

To execute the example a form with the TabSheetBox component using a data source is required. This procedure is to be assigned as the handler of the OnMouseDown event for the TabSheetBox component.

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

Var

TabS: ITabSheetBox;

Sheet: ITabSheet;

View: ITabView;

Point: IPoint;

Row, Column: Integer;

Begin

TabS := Sender As ITabSheetBox;

Sheet := TabS.Source.GetTabSheet;

View := Sheet.View;

Point := Args.pPoint;

View.HitTestCell(Point.X, Point.Y, Row, Column);

WinApplication.InformationBox("Row: " + Row.ToString + "; Column: " + Column.ToString);

End Sub TabSheetBox1OnMouseDown;

After executing the example and clicking on a cell of the TabSheetBox component, a message is displayed showing indexes of the row and the column containing this cell.

See also:

ITabView