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

# TCustomStringGrid

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The base class for TStringGrid.

## Declaration

Source position: grids.pas line 1751

`type TCustomStringGrid = class(TCustomDrawGrid)`
`protected`
`procedure AssignTo(); override;` |  | Assigns values from the current class instance to the target class instance.
`procedure AutoAdjustColumn(); override;` |  | Adjusts the column size for the font, text length, and images used in the specified column.
`procedure CalcCellExtent(); override;` |  | Deprecated in the ancestor class.
`procedure DefineProperties(); override;` |  | Defines non-published properties included in LCL component streaming.
`procedure DefineCellsProperty(); virtual;` |  | Defines the reader and writer for the Cells property in a TFiler instance.
`function DoCompareCells(); override;` |  | Performs a comparison between the specified cells in the grid control.
`procedure DoCopyToClipboard; override;` |  | Performs actions needed to copy a cell or a text selection to the clipboard.
`procedure DoCutToClipboard; override;` |  | Performs actions needed to cut a cell or a text selection to the clipboard.
`procedure DoPasteFromClipboard; override;` |  | Pastes data from the clipboard into the grid control.
`procedure DoCellProcess(); virtual;` |  | Performs actions needed when cell values are copied or pasted using the clipboard.
`procedure DrawColumnText(); override;` |  | Draws the text and image for a grid column title at the specified cell coordinates.
`procedure DrawTextInCell(); override;` |  | Draws the text for the specified cell in a given drawing state.
`procedure DrawCellAutonumbering(); override;` |  | Performs auto-numbering for a cell in the grid.
`function GetCells(); override;` |  | Gets the value for the indexed Cells property.
`procedure GetCheckBoxState(); override;` |  | Gets the state for a cell displayed as a Checkbox.
`function GetEditText(); override;` |  | Gets the text displayed in the Editor for the specified cell.
`procedure LoadContent(); override;` |  | Loads configuration settings from the specified XML configuration file.
`procedure Loaded; override;` |  | Performs actions when LCL component streaming has been completed.
`procedure SaveContent(); override;` |  | Saves configuration settings from SaveOptions and optionally values from Cells in the specified XML configuration file.
`procedure SelectionSetText();` |  | Stores the specified Tab-separated values to the Selection in the grid.
`procedure SelectionSetHTML();` |  | Sets the value for the current Selection to the specified HTML content.
`procedure SetCells(); virtual;` |  | Sets the value for the indexed Cells property.
`procedure SetCheckboxState(); override;` |  | Sets the checked state for a check box in the specified cell.
`procedure SetEditText(); override;` |  | Locks, updates, and unlocks the editor and cell text at the specified coordinates.
`property Modified: Boolean; [rw]` |  | Indicates whether the content in the grid cells has been changed.
`property OnCellProcess: TCellProcessEvent; [rw]` |  | Event handler signalled when copying or pasting content for Cells in the grid.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`procedure AutoSizeColumn();` |  | Automatically adjusts the width of a column to accommodate the widest text value in the column.
`procedure AutoSizeColumns;` |  | Resizes all columns to accommodate the longest text value in each column.
`procedure Clean();` |  | Removes cell content which match the specified options.
`procedure CopyToClipboard();` |  | Copies the current Selection range to the clipboard.
`procedure InsertRowWithValues();` |  | Inserts a row at the specified row position with the specified cell values.
`procedure LoadFromCSVStream(); virtual;` |  | Loads the grid content from the delimited values in AStream.
`procedure LoadFromCSVFile();` |  | Loads the grid from a file with delimited values for the columns and rows.
`procedure SaveToCSVStream();` |  | Saves grid content as comma-separated values in the specified stream instance.
`procedure SaveToCSVFile();` |  | Saves grid content as comma-separated values in the specified file name.
`property Cells []: string; [rw]` |  | Provides indexed access to a cell value by its column and row number.
`property Cols []: TStrings; [rw]` |  | Provides indexed access to the list of values for the specified column number.
`property DefaultTextStyle: TTextStyle;` |  | Default style used to display text including alignment, layout, wrapping, et. al.
`property EditorMode: Boolean;` |  | True when the Editor is ready to modify the value for the current cell.
`property ExtendedSelect: Boolean;` |  | Controls whether extending the current cell selection(s) on the control is enabled.
`property Objects []: TObject; [rw]` |  | Provides indexed access to a TObject instance associated with the cell.
`property Rows []: TStrings; [rw]` |  | Provides indexed access to the list of column values for the specified row number.
`property UseXORFeatures: Boolean;` |  | When True, the dotted focus rectangle is painted using an XOR raster operation.
`property ValidateOnSetSelection: Boolean;` |  | Controls validation when the text for the selected cell is changed.
`end;`

## Inheritance

`TCustomStringGrid` |  | The base class for TStringGrid.
`TCustomDrawGrid` |  | The base class for a custom-drawn grid control.
`TCustomGrid` |  | Implements the base class for grid controls.
`TCustomControl` |  | The base class for windowed controls which paint themselves.
`TWinControl` |  | Implements a windowed control which can contain other child controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TCustomStringGrid is a TCustomDrawGrid descendant which implements the base class for TStringGrid.

TCustomStringGrid provides the familiar tabular format used in grid controls, and is designed for use with string content stored in its cells. Internally, columns and rows in the class are mapped to TStringGridStrings instances used to store the values in the grid control. TCustomStringGrid also allows a TObject instance to be stored for each cell in the grid using the Objects property.

Additional information about grid usage is available on the Lazarus wiki in the following pages:

- Grids Reference Page
- TDrawGrid
- TStringGrid

## See also

TCustomStringGrid.Cells |  | Provides indexed access to a cell value by its column and row number.
TCustomStringGrid.Cols |  | Provides indexed access to the list of values for the specified column number.
TCustomStringGrid.Rows |  | Provides indexed access to the list of column values for the specified row number.
TCustomStringGrid.Objects |  | Provides indexed access to a TObject instance associated with the cell.
TCustomStringGrid.OnCellProcess |  | Event handler signalled when copying or pasting content for Cells in the grid.
HowToUseGrids |  | How to use Grids including StringGrids, DrawGrids and DbGrids.