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

The X and Y coordinates can be obtained using any table events, which argument contains the pPoint property.

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

Example

Executing the example requires a form with the TabSheetBox component using a data source. This procedure should be assigned as a 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