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

# TCustomGrid.HeaderClick

Performs actions needed when a mouse click occurs in a fixed header for a grid column or row.

## Declaration

Source position: grids.pas line 1127

`protected procedure TCustomGrid.HeaderClick(`
`IsColumn: Boolean;`
`index: Integer`
`); virtual;`

## Arguments

`IsColumn` |  | True if the click occurred on a column header. False for a row header.
`index` |  | Column (or row) number for the header click.

## Description

HeaderClick ensures that the value in SortOrder is toggled when Index contains the SortColumn defined for the grid control. SortOrder is set to soAscending when Index contains a column number other than SortColumn. SortColumn is updated in the method to use the value in Index as the active sort column.

HeaderClick calls the Sort method to sort all non-fixed rows in the grid control using the content from the column number in Index.

No actions are performed in the method when ColumnClickSorts is set to False.

IsColumn indicates whether the header click applies to a column or a row. When set to True, the mouse click occurred in a fixed header for the column number in Index. This parameter implies that similar handling is provided in the method for a header click on a fixed header in a row. No actions are performed for a header click on a row.

HeaderClick is overridden in descendent classes like TCustomDrawGrid to perform additional actions.

HeaderClick is called from methods like DialogChar and MouseUp.

## See also

TCustomGrid.SortColumn |  | Column number used to sort the rows in the grid.
TCustomGrid.SortOrder |  | Controls the order used for the sort column (ascending or descending).
TCustomGrid.ColumnClickSorts |  | Indicates if clicking a column header changes its sort order.
TCustomGrid.DialogChar |  | Applies an accelerator key for a column in the grid.
TCustomGrid.MouseUp |  | Handles a mouse up event for the grid control.
TCustomDrawGrid.HeaderClick |  | Performs actions when a mouse click occurs in a header for a grid column.