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

# TCustomGrid.DoOPDeleteColRow

Performs a delete operation for a column or a row.

## Declaration

Source position: grids.pas line 1044

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

## Arguments

`IsColumn` |  | True if Index refers to a column instead of a row.
`index` |  | Position for the column or row deleted in the method.

## Description

DoOPDeleteColRow is a method which performs actions needed to delete the specified column or row from the grid control.

IsColumn indicates whether a column or row is affected in the method. When set to True, the specified column number is deleted from the control. Otherwise, the specified row number is removed.

Use Index to specify the position for the column or row removed in the method.

Prior to removing the specified column or row, private methods are called to validate values used by or affected in the operation like:

Index
  Checks whether the value in Index is a valid column or row number. An EGridException exception is raised if Index has an invalid index value for the grid control.
FixedCols, FixedRows
  Ensures that new fixed column or row counts are valid for the number of columns or rows on the grid control. An EGridException is raised if the new values are not within the limits for the column or row count.
Col, Row, ColCount, RowCount
  Ensures that values for Col or Row are range limited to the new column or row count for the control. Calls MoveNextSelectable to scroll the grid control to the new origin cell when needed.

DoOPDeleteColRow ensures that a visible cell editor in the column or row is deactivated by setting EditorMode to False.

The ColRowDeleted method is called when the affected data has been removed from the grid control and the cached values in GCache. In a descendent class (TCustomDrawGrid), the OnColRowDeleted event handler is signalled (when assigned).

Col and Row are updated if the operation causes the selection range to be changed, and SelectCell is called to include the cell in Selection. Sizes for auto-filled columns are recalculated when needed. The cell Editor is updated when needed for the new selection and position on the grid control.

## See also

TCustomGrid.ColRowDeleted |  | Performs actions when a column or a row is deleted from the control.
TCustomGrid.Col |  | Column index for the selected grid cell.
TCustomGrid.ColCount |  | Number of columns in the grid.
TCustomGrid.Row |  | Row number for the selected grid cell.
TCustomGrid.RowCount |  | Number of rows in the grid.
TCustomGrid.FixedCols |  | The number of fixed columns in the grid.
TCustomGrid.FixedRows |  | Number of the fixed rows in the grid.
TCustomGrid.SelectCell |  | Determines whether the specified cell can be selected in the grid control.
TCustomGrid.Selection |  | Rectangle with the current cell selections in the grid control.
TCustomGrid.EditorMode |  | True when the Editor is ready to modify the value for the current cell.