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

# TCustomDrawGrid

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

TCustomDrawGrid - Base Class for drawn grids including TDrawGrid and TStringGrid

## Declaration

Source position: grids.pas line 1120

`type TCustomDrawGrid = class(TCustomGrid)`
`protected`
`FGrid: TVirtualGrid;` |  | FGrid - local variable holding a virtual grid on which to work
`procedure CalcCellExtent(); virtual;` |  | CalcCellExtent - calculate the dimensions required for the cell specified by aCol, aRow
`procedure CellClick(); override;`
`procedure ColRowDeleted(); override;` |  | ColRowDeleted - method for dealing with deletion of either a column or a row (depending on value of IsCol)
`procedure ColRowExchanged(); override;` |  | ColRowExchanged - method for exchanging the current Column or Row (depending on value of IsCol) with the indexed other column or row
`procedure ColRowInserted(); override;` |  | ColRowInserted - method for dealing with insertion of a column or row (depending on value of IsCol)
`procedure ColRowMoved(); override;` |  | ColRowMoved - the column or row (determined by IsColumn) is moved from one index to another
`function CreateVirtualGrid; virtual;` |  | CreateVirtualGrid - returns the created virtual grid
`procedure DrawCell(); override;` |  | DrawCell - draws a cell at the given grid location (Col, Row) or in the specified Rectangle
`procedure DrawCellAutonumbering(); virtual;` |  | DrawCellAutonumbering - draws a cell using auto numbering
`procedure DrawFocusRect(); override;` |  | DrawFocusRect - draws the rectangle currently receiving focus
`procedure GetCheckBoxState(); virtual;` |  | GetCheckBoxState - returns the state of the checkbox at the specified position
`function GetEditMask(); override;` |  | GetEditMask - returns the edit mask string for the specified cell
`function GetEditText(); override;` |  | GetEditText - returns the Edit text string for the specified cell
`procedure GridMouseWheel(); override;`
`procedure HeaderClick(); override;` |  | HeaderClick - method to deal with a click on the column (if IsColumn is True) or row Header
`procedure HeaderSized(); override;` |  | HeaderSized - method to deal with re-sizing of a column (IsColumn True) or row header
`procedure HeaderSizing(); override;`
`procedure KeyDown(); override;`
`procedure NotifyColRowChange();` |  | NotifyColRowChange tells the system that a column or row has been changed (determined by IsColumn) and whether this was an Insert
`function SelectCell(); override;` |  | Is called if a grid cell is highlighted.
`procedure SetColor(); override;` |  | SetColor to specified value
`procedure SetCheckboxState(); virtual;` |  | SetCheckboxState - specifies the state of the checkbox in the nominated cell
`procedure SetEditText(); override;` |  | SetEditText - specifies the text-string to be placed in the Editor for processing
`procedure SizeChanged(); override;` |  | SizeChanged - specifies the old number of columns and rows
`procedure ToggleCheckbox; virtual;` |  | ToggleCheckbox - toggles checkbox state between checked and unchecked
`property MouseWheelOption: TMouseWheelOption; [rw]`
`property OnGetCheckboxState: TGetCheckboxStateEvent; [rw]` |  | OnGetCheckboxState - event handler for finding checkbox state
`property OnSetCheckboxState: TSetCheckboxStateEvent; [rw]` |  | OnSetCheckboxState - event handler for specifying checkbox state
`public`
`constructor Create(); override;` |  | Create - constructor for TCustomDrawGrid: attaches a virtual grid then calls inherited Create
`destructor Destroy; override;` |  | Destroy - destructor for TCustomDrawGrid: frees the grid then calls inherited Destroy
`procedure DeleteColRow();` |  | Delete either a column or a row (specified by index), depending on the value of the boolean IsColumn
`procedure DeleteCol(); virtual;`
`procedure DeleteRow(); virtual;`
`procedure ExchangeColRow();` |  | Exchange either a column or a row, specified by index, with the col or row specified by WithIndex; boolean IsColumn determines whether rows or columns are to be exchanged
`procedure InsertColRow();` |  | InsertColRow inserts a column or row (specified by Iscolumn) at the stated index location
`procedure MoveColRow();` |  | Move column or row from FromIndex to ToIndex; boolean IsColumn specifies whether col or row is to be moved
`procedure SortColRow();` |  | Sort column or row specified by index and optionally by FromIndex and ToIndex; IsColumn specifies whether col or row is to be sorted
`procedure DefaultDrawCell(); virtual;` |  | Use the default method for drawing a cell specified by aCol, aRow, at location aRect with state aState
`property AllowOutboundEvents;` |  | AllowOutboundEvents - permits mouse click on an imaginary (out-of-bounds) cell; moves cursor to nearest valid cell
`property BorderColor;` |  | The colour of the border for this control
`property Canvas;` |  | The area of a control on which its components are drawn or painted
`property Col;` |  | Current column index.
`property ColWidths;` |  | Column widths for the grid.
`property Editor;` |  | The editor to be used for modifying information in the cells of the grid
`property EditorBorderStyle;` |  | The border style for the editor used in this grid
`property EditorMode;` |  | Is grid ready to accept edits? (EditorMode True)
`property ExtendedColSizing;` |  | ExtendedColSizing - the sizing to be used for extended columns
`property AltColorStartNormal;` |  | AltColorStartNormal - using a second colour to display alternate rows, but starting the first row with the normal colour
`property FastEditing;` |  | Is the FastEditing method being used?
`property FocusColor;` |  | The colour to be used for the cell receiving focus
`property FocusRectVisible;` |  | FocusRectVisible - is the rectangle receiving focus visible?
`property GridHeight;` |  | GridHeight - the height of the grid
`property GridLineColor;` |  | Colour to be used for GridLines
`property GridLineStyle;` |  | Style to be used for GridLines
`property GridWidth;` |  | Width of the whole Grid
`property IsCellSelected;` |  | IsCellSelected - is the cell specified by aCol, aRow selected?
`property LeftCol;` |  | LeftCol - the left-most column
`property Row;` |  | The current Row (record) within the grid
`property RowHeights;` |  | The row heights for the grid.
`property SaveOptions;` |  | The set of options for saving information from the grid (design, attributes, content or position)
`property SelectedColor;` |  | Colour to be used for selected cells
`property SelectedColumn;` |  | The column (field) currently selected
`property Selection;` |  | The current selection (rows and columns) in the grid
`property StrictSort;` |  | StrictSort - is strict sorting to be used?
`property TopRow;` |  | The first row (record) in the grid
`property UseXORFeatures;` |  | UseXORFeatures: When True, the dotted focus rectangle is painted using the XOR raster operation
`property Align;` |  | Used to align the control to the top, bottom, left or right of its client.
`property Anchors;` |  | The set of anchor definitions for this control
`property AutoAdvance;` |  | Automatically advance down the grid on successive mouse clicks or presses of the ENTER or TAB key
`property AutoFillColumns;` |  | Automatically resize columns so they fill all grid's visible area
`property BorderSpacing;` |  | Determines the border spacing for this control
`property BorderStyle;` |  | BorderStyle - none, or single
`property Color;` |  | Determine the colour for the current control
`property ColCount;` |  | Number of columns of the grid.
`property Columns;` |  | The properties of the columns in this grid
`property Constraints;` |  | Determine Constraints (max and min height and width) for this control
`property DefaultColWidth;` |  | Default value for the width of newly created grid columns.
`property DefaultDrawing;` |  | Is the default drawing method to be used for this grid? Default is TRUE
`property DefaultRowHeight;` |  | Default value for the height of newly created grid rows.
`property Enabled;` |  | Whether the control is Enabled (read/write). If not, it usually appears 'greyed-out'
`property FixedColor;` |  | The color for the fixed cells of the grid.
`property FixedCols;` |  | Number of the fixed columns of the grid (ie the columns containing title or identifier material, that don't get scrolled when the rest of the grid moves).
`property FixedHotColor;` |  | FixedHotColor - the 'Hot' colour for the active (selected, etc) fixed cells of the grid
`property FixedRows;` |  | Number of the fixed rows of the grid (ie the rows containing title or identifier material, that don't get scrolled when the rest of the grid moves).
`property Flat;` |  | Is the cell to be displayed Flat, ie with no texturing or raised/lowered effect
`property Font;` |  | The font to be used for text in this control (read/write).
`property GridLineWidth;` |  | Width (thickness) of GridLines
`property Options;` |  | The options available for use in this grid
`property ParentShowHint;` |  | ParentShowHint - does the control adopt the same hinting behaviour as its parent? Default is true
`property PopupMenu;` |  | PopupMenu - a context-sensitive menu that pops up when the right mouse button is clicked over this control
`property RowCount;` |  | Number of rows in the grid
`property ScrollBars;` |  | The ScrollBars to be used with this grid
`property ShowHint;` |  | Flag to determine: Is hint to be displayed for this control?
`property TabOrder;` |  | The place this control occupies in the list of tabs
`property TabStop;` |  | Is the control in the sequence of controls accessed by successive presses of the Tab key?
`property Visible;` |  | Visible - can the control be seen?
`property VisibleColCount;` |  | The number of visible columns
`property VisibleRowCount;` |  | The number of visible rows
`property OnBeforeSelection;` |  | OnBeforeSelection - event handler for use before a selection is made
`property OnClick;` |  | Event Handler for mouse click
`property OnColRowDeleted: TGridOperationEvent; [rw]` |  | Event handler when a grid column or row is deleted
`property OnColRowExchanged: TGridOperationEvent; [rw]` |  | Event handler when a grid column or row has its position exchanged with another
`property OnColRowInserted: TGridOperationEvent; [rw]` |  | Event handler when a column or row is inserted into the grid
`property OnColRowMoved: TGridOperationEvent; [rw]` |  | Event handler when a grid column or row is moved
`property OnCompareCells;` |  | Event handler for comparing the contents of cells
`property OnContextPopup;` |  | Event handler to supply information when a context-sensitive pop-up menu is required
`property OnDblClick;` |  | Event Handle for mouse double-click
`property OnDragDrop;` |  | Event handler for the drop of a control onto this control.
`property OnDragOver;` |  | Event handler for the case when a control is dragged over another control
`property OnDrawCell;` |  | Event handler for drawing a cell
`property OnEditButtonClick;` |  | Event handler for when the Edit button is clicked
`property OnEndDock;` |  | Event handler for the end of a docking operation
`property OnEndDrag;` |  | Event handler for the end of a dragging process
`property OnEnter;` |  | OnEnter - event handler for when the mouse enters the control, and the control receives focus
`property OnExit;` |  | OnExit - event handler for when the mouse leaves the control and it loses focus
`property OnGetEditMask: TGetEditEvent; [rw]` |  | Event handler for finding the edit mask while editing a grid cell
`property OnGetEditText: TGetEditEvent; [rw]` |  | Event handler for finding the text to be edited in a grid cell
`property OnHeaderClick: THdrEvent; [rw]` |  | Event handler when a column or row header is clicked
`property OnHeaderSized: THdrEvent; [rw]` |  | Event handler when a column or row header is re-sized
`property OnHeaderSizing: THeaderSizingEvent; [rw]`
`property OnKeyDown;` |  | OnKeyDown - event handler for instance when key is down while control has focus
`property OnKeyPress;` |  | OnKeyPress - event controller for a key being pressed while the control has focus. To properly handle national chars use UTF8KeyPress instead.
`property OnKeyUp;` |  | OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus
`property OnMouseDown;` |  | Event handler for when a mouse button is pressed down
`property OnMouseMove;` |  | Event handler for mouse movement within the current control
`property OnMouseUp;` |  | Event handler for when the mouse button is released, ie "up"
`property OnMouseWheelDown;` |  | OnMouseWheelDown - event handler for downward movement of mouse wheel
`property OnMouseWheelUp;` |  | OnMouseWheelUp - event handler for upward movement of mouse wheel
`property OnPickListSelect;` |  | Event handler for selecting an item from a picklist (eg drop-down list in TComboBox)
`property OnPrepareCanvas;` |  | Event handler to prepare the Canvas for drawing
`property OnSelectEditor;` |  | Event handler for selecting an editor
`property OnSelection;` |  | Event handler for when an area of a grid (one or a group of cells) is selected
`property OnSelectCell: TOnSelectCellEvent; [rw]` |  | Event handler when a grid cell is selected
`property OnSetEditText: TSetEditEvent; [rw]` |  | Event handler for storing the text that has been edited in a cell
`property OnStartDock;` |  | Event handler for the start of a docking operation
`property OnStartDrag;` |  | Event handler for start of dragging operation
`property OnTopleftChanged;` |  | Event handler when the top left cell is changed (ie the grid has been scrolled so that a different cell occupies top left)
`property OnUTF8KeyPress;` |  | UTF8KeyPress - event controller for a key being pressed while the control has focus.
`end;`

## Inheritance

`TCustomDrawGrid` |  | TCustomDrawGrid - Base Class for drawn grids including TDrawGrid and TStringGrid
`TCustomGrid` |  | TCustomGrid - the base class for all grid controls
`TCustomControl` |  | TCustomControl - a base class for many window controls
`TWinControl`
`TControl`
`TLCLComponent` |  | TLCLComponent - base class for LCL components
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent`
`TObject`

## See also

HowToUseGrids |  | How to use Grids including StringGrids, DrawGrids and DbGrids

The latest version of this document can be found at lazarus-ccr.sourceforge.net .