Sign in Join
FPDoc Onlineexperiment

TCustomGrid.MouseToCell function

Member of TCustomGridpublicIn unit Grids

Converts the specified mouse screen coordinates to cell coordinates.

Declaration

pascal
function MouseToCell(const Mouse: TPoint): TPoint; overload
procedure MouseToCell(X: Integer; Y: Integer; out ACol: LongInt; 
 out ARow: LongInt); overload

Arguments

Mouse

TPoint instance with the mouse coordinates converted in the method.

X

Horizontal coordinate for the mouse.

Y

Vertical coordinate for the mouse.

ACol

Column number for the mouse position.

ARow

Row number for the mouse position.

Function result

TPoint instance with the grid coordinates for the cell.

Description

MouseToCell is an overloaded method in TCustomGrid used to convert screen coordinates for the mouse pointer to cell coordinates. One variant returns the cell coordinates as a TGridCoord (an alias for TPoint) instance. The other variant returns the cell coordinates as Integer output parameters. MouseToCell calls the OffsetToColRow method to get the cell coordinates.

ACol and ARow arguments were changed to output parameters in LCL version 2.1 (revision 65087).

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.