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

TCustomDrawGrid

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

The base class for a custom-drawn grid control.

Declaration

Source position: grids.pas line 1369

type TCustomDrawGrid = class(TCustomGrid)

protected

  FGrid: TVirtualGrid;

  

Contains the virtual grid for the control.

  procedure CellClick(); override;

  

Performs actions to handle a mouse click in the specified cell.

  procedure ColRowDeleted(); override;

  

Performs actions when a column or a row is deleted from the control.

  procedure ColRowExchanged(); override;

  

Performs a notification when column or row data is exchanged in the grid.

  procedure ColRowInserted(); override;

  

Performs a notification when column or row data is inserted in the grid.

  procedure ColRowMoved(); override;

  

Performs a notification when column or row data is moved in the grid.

  function CreateVirtualGrid; virtual;

  

Creates and returns a virtual grid for the control.

  procedure DrawCell(); override;

  

Draws a cell using a given state at the specified grid location (Col, Row, rectangle).

  procedure DrawCellAutonumbering(); virtual;

  

Draws a cell with auto-numbering.

  procedure DrawFocusRect(); override;

  

Draws the focus rectangle for the control.

  function GetCells(); override;

  

Gets the value for the specified cell.

  procedure GetCheckBoxState(); virtual;

  

Gets the check box state for the cell at the specified coordinates.

  function GetEditMask(); override;

  

Gets the edit mask for the specified cell.

  function GetEditText(); override;

  

Gets the text displayed in the Editor for the specified cell.

  procedure GridMouseWheel(); override;

  

Performs actions when the mouse wheel is scrolled in the grid control.

  procedure HeaderClick(); override;

  

Performs actions when a mouse click occurs in a header for a grid column.

  procedure HeaderSized(); override;

  

Performs actions needed when a column or a row has been resized.

  procedure HeaderSizing(); override;

  

Performs actions when resizing a column or row to the specified size.

  procedure KeyDown(); override;

  

Handles key down events for the grid control.

  procedure NotifyColRowChange();

  

Performs a notification when a column or row has been changed.

  function SelectCell(); override;

  

Determines whether the specified cell can be selected in the grid control.

  procedure SetColor(); override;

  

Sets the value for the Color property.

  procedure SetCheckboxState(); virtual;

  

Sets the value for a CheckBox in the specified cell to a given state.

  procedure SetEditText(); override;

  

Sets the value used in the cell Editor to the specified text.

  procedure SizeChanged(); override;

  

Performs actions needed when the number or columns or rows has been changed.

  procedure ToggleCheckbox; virtual;

  

Toggles the state for a checkbox cell between the checked and unchecked values.

  property OnGetCheckboxState: TGetCheckboxStateEvent; [rw]

  

Event handler signalled to get the state for a checkbox cell.

  property OnSetCheckboxState: TSetCheckboxStateEvent; [rw]

  

Event handler signalled to set the state for a checkbox cell.

public

  constructor Create(); override;

  

Constructor for the class instance.

  destructor Destroy; override;

  

Destructor for the class instance.

  procedure DeleteColRow();

  

Deletes a column or a row at the specified position.

  procedure DeleteCol(); virtual;

  

Deletes the column at the specified position.

  procedure DeleteRow(); virtual;

  

Deletes the row at the specified position.

  procedure ExchangeColRow(); virtual;

  

Exchanges column or row values at the specified positions.

  procedure InsertColRow();

  

Inserts a column or a row at the specified position.

  procedure MoveColRow();

  

Moves a column or a row from a specified position to a new position in the grid.

  procedure SortColRow();

  

Sorts the data in a column or row using the specified positions.

  procedure DefaultDrawCell(); virtual;

  

The default method used to draw the cell at the given position using a specific state.

  property AllowOutboundEvents: Boolean;

  

Allows a mouse click on an out-of-bounds cell; moves cursor to nearest valid cell.

  property BorderColor: TColor;

  

The color used for the border on the control.

  property Canvas: TCanvas;

  

The drawing surface for the control.

  property Col: Integer;

  

Column index for the selected grid cell.

  property ColWidths: Integer;

  

Provides indexed access to the Width of the column in the grid.

  property ColRow: TPoint;

  

Provides access to current column and row numbers as a TPoint instance.

  property DisabledFontColor: TColor;

  

Color used to draw text in the grid when Enabled is set to False.

  property Editor: TWinControl;

  

The editor used to modify the value in the current cell.

  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 AltColorStartNormal: Boolean;

  

Indicates if alternate row coloring starts with the normal row color.

  property FastEditing: Boolean;

  

Indicates if "Fast Editing" is enabled in the grid.

  property FixedGridLineColor: TColor;

  

Color used to draw lines around fixed grid cells.

  property FocusColor: TColor;

  

The color used for a cell when it has focus.

  property FocusRectVisible: Boolean;

  

Indicates if the focus rectangle is visible for the control.

  property GridHeight: Integer;

  

Total height for all of the rows in the grid control.

  property GridWidth: Integer;

  

Total width for all columns in the Grid including non-visible columns.

  property IsCellSelected: Boolean;

  

Provides indexed access to the selected state for a cell by its column and row number.

  property LeftCol: Integer;

  

Column number for the first visible column on the left edge of the grid.

  property Row: Integer;

  

Row number for the selected grid cell.

  property RowHeights: Integer;

  

Provides indexed access to the height for each row in the grid.

  property SaveOptions: TSaveOptions;

  

Options which control the information saved and loaded for the grid control.

  property SelectedColor: TColor;

  

Color used for selected cells in the grid.

  property SelectedColumn: TGridColumn;

  

The column instance for the currently selected cell in the grid control.

  property Selection: TGridRect;

  

Rectangle with the current cell selections in the grid control.

  property StrictSort: Boolean;

  

Indicates if strict sorting is used.

  property TopRow: Integer;

  

The first visible row in the grid.

  property UseXORFeatures: Boolean;

  

When True, the dotted focus rectangle is painted using an XOR raster operation.

  property Align: TAlign;

  

Specifies the placement of the control inside its Parent.

  property Anchors: TAnchors;

  

The set of anchor definitions for this control.

  property AutoAdvance: TAutoAdvance;

  

Direction used when automatically moving the selection to the next selectable cell.

  property AutoFillColumns: Boolean;

  

Automatically resizes columns so they fill all of the visible area in the grid.

  property BorderSpacing: TControlBorderSpacing;

  

Determines the inner and outer border spacing for this control.

  property BorderStyle: TBorderStyle;

  

Indicates if borders are displayed around the control.

  property Color: TColor;

  

The background color of the control.

  property ColCount: Integer;

  

Number of columns in the grid.

  property Columns: TGridColumns;

  

Definitions for the columns in the grid.

  property Constraints: TSizeConstraints;

  

The minimum and maximum Width and Height for the control.

  property DefaultColWidth: Integer;

  

Default width used for newly created grid columns.

  property DefaultDrawing: Boolean;

  

Indicates if the default drawing mechanism is used to draw the background for cells.

  property DefaultRowHeight: Integer;

  

Default row height for newly created grid rows.

  property Enabled: Boolean;

  

Determines whether the control reacts on mouse or keyboard input.

  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 selected, hot-lighted, etc. fixed cells in the grid.

  property FixedRows: Integer;

  

Number of the fixed rows 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 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 GridLineWidth: Integer;

  

Width (thickness) for grid lines drawn on the control.

  property Options: TGridOptions;

  

Contains the set of optional features and/or behaviors enabled for the grid.

  property Options2: TGridOptions2;

  

Contains additional options enabled for the grid control.

  property ParentShowHint: Boolean;

  

If true, the value of ShowHint for the control will be the same as the one from the Parent. Default is true.

  property PopupMenu: TPopupMenu;

  

A context-sensitive menu that pops up when the right mouse button is clicked over this control.

  property RowCount: Integer;

  

Number of rows in the grid.

  property ScrollBars: TScrollStyle;

  

Scrollbars displayed for the grid control.

  property ShowHint: Boolean;

  

Enables the Hint display.

  property TabAdvance: TAutoAdvance;

  

Controls the behavior for Tab navigation in the grid control.

  property TabOrder: TTabOrder;

  

Determines the sequence of control navigation when the user presses the Tab key.

  property TabStop: Boolean;

  

Allows the user to navigate to this control, by pressing the Tab key.

  property Visible: Boolean;

  

Allows the control, and all of its children, to be displayed or hidden.

  property VisibleColCount: Integer;

  

The number of visible columns in the grid control.

  property VisibleRowCount: Integer;

  

The number of visible rows in the grid control.

  property OnAfterSelection: TOnSelectEvent;

  

Event handler signalled after a new Selection is made in the grid.

  property OnBeforeSelection: TOnSelectEvent;

  

Event handler signalled before changing the Selection in the grid control.

  property OnClick: TNotifyEvent;

  

Notification handler for mouse clicks.

  property OnColRowDeleted: TGridOperationEvent; [rw]

  

Event handler signalled when a grid column or row is deleted.

  property OnColRowExchanged: TGridOperationEvent; [rw]

  

Event handler signalled when a column or row has been exchanged with another.

  property OnColRowInserted: TGridOperationEvent; [rw]

  

Event handler signalled when a column or row is inserted into the grid.

  property OnColRowMoved: TGridOperationEvent; [rw]

  

Event handler signalled when a column or row in the grid is moved.

  property OnCompareCells: TOnCompareCells;

  

Event handler signalled to compare the content in cells

  property OnContextPopup: TContextPopupEvent;

  

Invoked when a context-sensitive pop-up menu is requested.

  property OnDblClick: TNotifyEvent;

  

Event Handler for double mouse clicks.

  property OnDragDrop: TDragDropEvent;

  

This handler determines the action on an drop onto this control, in a drag-drop operation.

  property OnDragOver: TDragOverEvent;

  

Event handler for a control being dragged over this control.

  property OnDrawCell: TOnDrawCell;

  

Event handler signalled to draw a cell in the grid control.

  property OnEditButtonClick: TNotifyEvent; deprecated ;

  

Event handler signalled when the button in an Editor is clicked.

  property OnButtonClick: TOnSelectEvent;

  

Event handler signalled when a button in a column header is clicked.

  property OnEndDock: TEndDragEvent;

  

Notification handler for the end of a docking operation.

  property OnEndDrag: TEndDragEvent;

  

Notification handler for the end of a dragging operation.

  property OnEnter: TNotifyEvent;

  

Handler for control receiving the focus.

  property OnExit: TNotifyEvent;

  

Handler for control loosing the focus; This is a good place for checking the finished user input.

  property OnGetEditMask: TGetEditEvent; [rw]

  

Event handler signalled to get the edit mask used for a grid cell.

  property OnGetEditText: TGetEditEvent; [rw]

  

Event handler signalled to get the value for a cell editor in the grid.

  property OnHeaderClick: THdrEvent; [rw]

  

Event handler signalled when the fixed header for a column or row is clicked.

  property OnHeaderSized: THdrEvent; [rw]

  

Event handler signalled when a column or row header has been re-sized.

  property OnHeaderSizing: THeaderSizingEvent; [rw]

  

Event handler signalled when a column or row header sizing action is performed.

  property OnKeyDown: TKeyEvent;

  

Handler for keyboard key pressed.

  property OnKeyPress: TKeyPressEvent;

  

Handler for a character entered by the user.

  property OnKeyUp: TKeyEvent;

  

Handler for keyboard key released.

  property OnMouseDown: TMouseEvent;

  

Event handler for mouse button going down.

  property OnMouseEnter: TNotifyEvent;

  

Event handler for mouse entering the area of the control.

  property OnMouseLeave: TNotifyEvent;

  

Event handler for mouse leaving the area of the control.

  property OnMouseMove: TMouseMoveEvent;

  

Event handler for mouse movement within the control.

  property OnMouseUp: TMouseEvent;

  

Event handler for mouse button going up.

  property OnMouseWheel: TMouseWheelEvent;

  

Event handler for mouse wheel turned.

  property OnMouseWheelDown: TMouseWheelUpDownEvent;

  

Event handler for downward movement of mouse wheel.

  property OnMouseWheelUp: TMouseWheelUpDownEvent;

  

Event handler for upward movement of the mouse wheel.

  property OnPickListSelect: TNotifyEvent;

  

Event handler signalled when an item is selected from a pick list.

  property OnPrepareCanvas: TOnPrepareCanvasEvent;

  

Event handler signalled to prepare the Canvas for drawing.

  property OnSelectEditor: TSelectEditorEvent;

  

Event handler signalled to select a cell Editor for the current cell.

  property OnSelection: TOnSelectEvent;

  

Event handler signalled when an area is selected in the grid control.

  property OnSelectCell: TOnSelectCellEvent; [rw]

  

Event handler signalled when a grid cell is selected.

  property OnSetEditText: TSetEditEvent; [rw]

  

Event handler signalled when the text in the cell Editor is assigned.

  property OnStartDock: TStartDockEvent;

  

Event handler for the start of a docking operation.

  property OnStartDrag: TStartDragEvent;

  

Event handler for the start of a dragging operation.

  property OnTopleftChanged: TNotifyEvent;

  

Event handler signalled when the top left cell is changed.

  property OnUTF8KeyPress: TUTF8KeyPressEvent;

  

Handler for a character entered by the user.

  property OnValidateEntry: TValidateEntryEvent;

  

Event handler signalled to perform validation for a cell value.

end;

Inheritance

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

  

The base class for controls 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

TCustomDrawGrid is a TCustomGrid descendant used as the base class for custom-drawn grids including TDrawGrid and TStringGrid. Applications should not create instance of TCustomDrawGrid; use one of the descendent classes like TDrawGrid or TStringGrid.

TCustomDrawGrid provides overridden methods needed to work with cells using the TVirtualGrid class instance in the Grid property. It displays information as a matrix of rows and columns, and is oriented towards rendering both graphical information and textual content.

The OnDrawCell event handler is provided to render the cell content in the grid, and can be used to render images or directly access the Canvas for the control. Default cell drawing logic is also implemented using the properties and methods from the ancestor class, and may be accessed from within the OnDrawCell event handler.

See also

TCustomGrid

  

Implements the base class for grid controls.

TDrawGrid

  

Implements a custom-drawn grid control.

TStringGrid

  

Implements a specialized grid for displaying textual content.

TOnDrawCell

  

Defines the event handler signalled to draw a cell a grid control.

HowToUseGrids

  

How to use Grids including StringGrids, DrawGrids and DbGrids.

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