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

# TDBGrid

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

Data-aware grid control used to display and edit rows and columns in a dataset.

## Declaration

Source position: dbgrids.pas line 566

`type TDBGrid = class(TCustomDBGrid)`
`public`
`property BorderColor: TColor;` |  | The color used for the border on the control.
`property Canvas: TCanvas;` |  | The drawing surface for the control.
`property DefaultTextStyle: TTextStyle;` |  | Default style used to display text including alignment, layout, wrapping, et. al.
`property EditorBorderStyle: TBorderStyle;` |  | The border style for the Editor control.
`property EditorMode: Boolean;` |  | True when the Editor is ready to modify the value for the current cell.
`property ExtendedColSizing: Boolean;` |  | Indicates if extended column sizing is enabled in the grid.
`property FastEditing: Boolean;` |  | Indicates if "Fast Editing" is enabled in the grid.
`property FocusColor: TColor;` |  | The color used to draw the focus rectangle when a cell has focus.
`property FocusRectVisible: Boolean;` |  | Indicates if the focus rectangle is displayed for the control.
`property GridLineColor: TColor;` |  | Color used for the grid lines on the control.
`property GridLineStyle: TPenStyle;` |  | Style used to draw the grid lines on the control.
`property InplaceEditor: TWinControl;` |  | Cell editor for the grid control.
`property SelectedColor: TColor;` |  | Color used for selected cells in the grid.
`property SelectedRows: TBookmarkList;` |  | SelectedRows are the recorded rows in a bookmark list.
`property OnRowMoved: TMovedEvent;` |  | Event handler signalled when a row is moved on the grid control.
`published`
`property Align: TAlign;` |  | Specifies the placement of the control on its Parent control.
`property AlternateColor: TColor;` |  | Color used for the background in alternate rows in the grid.
`property Anchors: TAnchors;` |  | The set of anchor definitions for this control.
`property AutoAdvance: TAutoAdvance;` |  | Sets the auto advance option for the grid control.
`property AutoEdit: Boolean;` |  | Indicates if edit mode is automatically entered when a cell is selected.
`property AutoFillColumns: Boolean;` |  | Indicates whether columns are automatically resized to fill the visible area in the grid.
`property BiDiMode: TBiDiMode;` |  | Indicates whether text controls use in bi-directional reading.
`property BorderSpacing: TControlBorderSpacing;` |  | Determines the inner and outer border spacing for this control.
`property BorderStyle: TBorderStyle;` |  | Border style drawn around the grid control.
`property CellHintPriority: TCellHintPriority;` |  | Identifies how text is combined to form the Hint property.
`property Color: TColor;` |  | The background color for the control.
`property ColRowDraggingCursor: TCursor;` |  | Cursor shape displayed when a column or row is dragged in the grid control.
`property ColRowDragIndicatorColor: TColor;` |  | Color used to render the drag cursor when a column or row is dragged in the grid.
`property ColSizingCursor: TCursor;` |  | Cursor shape displayed when a column is resized.
`property Columns: TDBGridColumns;` |  | Defines the dataset fields and their editing characteristics on the grid control.
`property Constraints: TSizeConstraints;` |  | Contains the minimum and maximum Width and Height for the control.
`property DataSource: TDataSource;` |  | Provides access to the dataset displayed in the grid.
`property DefaultDrawing: Boolean;` |  | Indicates if the default drawing mechanism is used to draw the background and text for cells.
`property DefaultRowHeight: Integer;` |  | Default height for rows drawn in the grid control.
`property DoubleBuffered: Boolean;` |  | When enabled, it reduces flicker when the control is painted.
`property DragCursor: TCursor;` |  | The cursor shape shown during a drag operation.
`property DragMode: TDragMode;` |  | Determines how a drag operation is started for the control.
`property Enabled: Boolean;` |  | Determines if the grid control is enabled for navigation and editing.
`property FixedColor: TColor;` |  | The color used for the fixed cells in the grid.
`property FixedCols: Integer;` |  | The number of fixed columns in the grid.
`property FixedHotColor: TColor;` |  | The color used for hot-lighted fixed cells in the grid.
`property Flat: Boolean;` |  | Indicates if cells are displayed using a Flat appearance.
`property Font: TFont;` |  | The font to be used for text display in this control.
`property HeaderHotZones: TGridZoneSet;` |  | Contains the grid zones which are hot-lighted (hovered) on the control.
`property HeaderPushZones: TGridZoneSet;` |  | Contains the grid zones which are drawn in a "pushed" state on the control.
`property Options: TDbGridOptions;` |  | Contains the optional features or behaviors that are enabled for the grid control.
`property Options2: TGridOptions2;` |  | Contains additional options for scrolling and editor behavior enabled in the grid control.
`property OptionsExtra: TDbGridExtraOptions;` |  | Contains the extra options enabled for the database grid control.
`property ParentBiDiMode: Boolean;` |  | Indicates whether the BiDiMode settings in the Parent control are used.
`property ParentColor: Boolean;` |  | Uses the Color from the Parent control, when enabled.
`property ParentDoubleBuffered: Boolean;` |  | Value for the DoubleBuffered property in a Parent control.
`property ParentFont: Boolean;` |  | Indicates if the Font from the Parent control is used in the control.
`property PopupMenu: TPopupMenu;` |  | A context-sensitive menu that pops up when the right mouse button is clicked over this control.
`property ReadOnly: Boolean;` |  | Indicates if modifications are allowed in the grid control.
`property Scrollbars: TScrollStyle;` |  | Scroll bars displayed for the grid control.
`property ShowHint: Boolean;` |  | Controls whether the Hint is displayed for the control.
`property TabAdvance: TAutoAdvance;` |  | Controls the behavior for Tab navigation in the grid control.
`property TabOrder: TTabOrder;` |  | Indicates the navigation order for the control when the user presses the Tab or Shift+Tab key.
`property TabStop: Boolean;` |  | Allows the user to navigate to / from the control by pressing the Tab or Shift+Tab keys.
`property TitleFont: TFont;` |  | The font used for text in a column title.
`property TitleImageList: TCustomImageList;` |  | The list with images displayed in column titles.
`property TitleStyle: TTitleStyle;` |  | The drawing style used for the fixed column titles.
`property UseXORFeatures: Boolean;` |  | When True, the dotted focus rectangle is painted using an XOR raster operation.
`property Visible: Boolean;` |  | Visible controls whether the grid control is visible.
`property OnCellClick: TDBGridClickEvent;` |  | Event handler signalled for a mouse click in a grid column.
`property OnColEnter: TNotifyEvent;` |  | Event handler signalled when the mouse enters a column.
`property OnColExit: TNotifyEvent;` |  | Event handler signalled when the mouse exits a column.
`property OnColumnMoved: TMovedEvent;` |  | Event handler signalled when the order of a column is changed.
`property OnColumnSized: TNotifyEvent;` |  | Event handler signalled when a grid column has been resized.
`property OnContextPopup: TContextPopupEvent;` |  | Invoked when a context-sensitive pop-up menu is requested.
`property OnDrawColumnCell: TDrawColumnCellEvent;` |  | Event handler signalled when a cell needs to be drawn.
`property OnDrawColumnTitle: TDrawColumnCellEvent;` |  | Event handler signalled when a cell title needs to be drawn.
`property OnDblClick: TNotifyEvent;` |  | Event handler signalled when a mouse double click occurs in the control.
`property OnDragDrop: TDragDropEvent;` |  | Event handler signalled when an object is dropped onto the control.
`property OnDragOver: TDragOverEvent;` |  | Event handler signalled when a control is dragged over the control instance.
`property OnEditButtonClick: TNotifyEvent;` |  | Event handler signalled when the button in a cell Editor is clicked. Deprecated.
`property OnEditingDone: TNotifyEvent;` |  | Event handler signalled when editing is completed for the control.
`property OnEndDrag: TEndDragEvent;` |  | Event handler signalled for the end of a drag-drop operation.
`property OnEnter: TNotifyEvent;` |  | Event handler signalled when the control receives focus.
`property OnExit: TNotifyEvent;` |  | Event handler signalled when the control loses focus.
`property OnFieldEditMask: TGetDbEditMaskEvent;` |  | Event handler signalled to get the edit mask for a Field.
`property OnGetCellHint: TDbGridCellHintEvent;` |  | Event handler signalled to get the hint text for a cell in the grid control.
`property OnKeyDown: TKeyEvent;` |  | Event handler signalled when a key is down while the control has focus.
`property OnKeyPress: TKeyPressEvent;` |  | Event handler signalled for the key press event.
`property OnKeyUp: TKeyEvent;` |  | Event handler signalled for a key up event.
`property OnMouseDown: TMouseEvent;` |  | Event handler signalled when a mouse down event is handled for the control.
`property OnMouseEnter: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has entered the control.
`property OnMouseLeave: TNotifyEvent;` |  | Event handler signalled when the mouse pointer has left the control.
`property OnMouseMove: TMouseMoveEvent;` |  | Event handler signalled when the mouse pointer is moved in the control.
`property OnMouseUp: TMouseEvent;` |  | Event handler signalled when a mouse up event is handled for the control.
`property OnMouseWheel: TMouseWheelEvent;` |  | Event handler for mouse wheel turned.
`property OnMouseWheelDown: TMouseWheelUpDownEvent;` |  | Event handler signalled for a downward movement of the mouse wheel.
`property OnMouseWheelUp: TMouseWheelUpDownEvent;` |  | Event handler signalled for an upward movement of the mouse wheel.
`property OnPrepareCanvas: TPrepareDbGridCanvasEvent;` |  | Event handler signalled to prepare the grid canvas for drawing a cell.
`property OnSelectEditor: TDbGridSelEditorEvent;` |  | Event handler signalled when the editor is selected for a Field in the grid.
`property OnStartDrag: TStartDragEvent;` |  | Event handler signalled for the start of a dragging operation.
`property OnTitleClick: TDBGridClickEvent;` |  | Event handler for mouse clicks on a Title cell.
`property OnUserCheckboxBitmap: TDbGridCheckBoxBitmapEvent;` |  | Event handler signalled to get the user-defined bitmap used for a check box cell.
`property OnUserCheckboxImage: TUserCheckBoxImageEvent;` |  | Event handler signalled to get the user-defined image used for a check box cell.
`property OnUserCheckboxState: TDbGridCheckboxStateEvent;` |  | Event handler signalled to get a user-specified value for a check box editor on the grid control.
`property OnUTF8KeyPress: TUTF8KeyPressEvent;` |  | Handler for a character entered by the user.
`end;`

## Inheritance

`TDBGrid` |  | Data-aware grid control used to display and edit rows and columns in a dataset.
`TCustomDBGrid` |  | TCustomDBGrid is the base class for TDBGrid.
`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

TDBGrid is a data-aware version of TStringGrid used to display and edit a Rows and Columns in a dataset.

TDBGrid inherits many of its properties from TCustomGrid and its immediate ancestor TCustomDBGrid.

## See also

How To Use Data-Aware Controls |  | HowToUseDataAwareControls - Hints for accessing databases.
How To Use Grids |  | How to use Grids including StringGrids, DrawGrids and DbGrids.