Events and properties to control the reaction of the mouse

AdminAbout 1 min

Events and properties to control the reaction of the mouse

The grid contains the standard event OnMouseDown; OnMouseMove; OnMouseUp; to handle mouse events. In the event you can use the following methods to determine the number of the cell that worked Event

function MouseCoord(X, Y: Integer): TGridCoord;

function returns the position of the cell in the coordinates of the client area of the grid. If X, Y coordinates do not fall in a cell, one of the values or TGridCoord.X TGridCoord.Y will be -1.

Grid provides a set of events in which the coordinates are transmitted cells in which there was a click.

TDBGridEh.OnCellClick

The event occurs only when you click on the cells in the data section. The event is passed a column Column: TColumnEh, which clicked.

TDBGridEh.OnCellMouseClick

The event occurs when user clicks any cell in the grid. The event have the following parameters

Grid: TCustomGridEh Grid in which the event occurred Cell: TGridCoord The cell in which the event occurred

Button: TMouseButton Type of pressed button

Shift: TShiftState; State of additional buttons

X, Y: Integer; The coordinates of the mouse relative to the cell

var Processed: Boolean Set Processed in True to indicate that you have been treated in a reaction event and call the default handler is not necessary.

In the event you can call the default handler - TCustomGridEh.DefaultCellMouseClick.

Useful methods and properties for obtaining data on the area of the grid in which the event occurred:

function GetCellAreaType(ACol, ARow: Integer; 
  var AreaCol, AreaRow: Integer): TCellAreaTypeEh;

get the type of horizontal and vertical grid area in which the event occurred. Horizontally the grid is divided into the following areas:

hctIndicatorEh Indicator area

hctDataEh Data area

Vertically the grid is divided into the following areas:

vctTitleEh header area

vctSubTitleEh The area under the heading filter

vctDataEh data area

vctAboveFooterEh The area between the footer and data

vctFooterEh footer area


TDBGridEh.OnGetBtnParams

Event occurs by clicking on the header and is used for special painting of a pressed title.

TDBGridEh.OnTitleBtnClick

The event is called when you click in the header area that is configured to work as a button. To trigger events in the header the Column.Title.TitleButton property should be set to True.

TDBGridEh.OnTitleClick

The event is called when you click in the header area.
Last update:
Contributors: dmitrybv