[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'Grids' (#lcl)

TCustomGrid.MouseToCell

Converts the specified mouse screen coordinates to cell coordinates.

Declaration

Source position: grids.pas line 1367

public function TCustomGrid.MouseToCell(

  const Mouse: TPoint

):TPoint; overload;

procedure TCustomGrid.MouseToCell(

  X: Integer;

  Y: Integer;

  out ACol: LongInt;

  out ARow: LongInt

); overload;

Arguments

Mouse

  

TPoint instance with the mouse coordinates converted in the method.

Function result

TPoint instance with the grid coordinates for the cell.

Arguments

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.

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.

Version info

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


Version 4.0 Generated 2025-05-03 Home