[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 header for a grid column.

Declaration

Source position: grids.pas line 1102

protected procedure TCustomGrid.HeaderClick(

  IsColumn: Boolean;

  index: Integer

); virtual;

Arguments

IsColumn

  

True if the click occurred on a column 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 perfomed 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.