Skip to main content

Overview

TCustomTeeGrid is the abstract base class for all TeeGrid implementations. It provides the core architecture, data management, and rendering framework that is shared between VCL and FireMonkey versions of TTeeGrid.
TCustomTeeGrid is an abstract class and cannot be instantiated directly. Use TTeeGrid (VCL or FMX) instead.

Architecture

TCustomTeeGrid serves as the foundation for the grid component hierarchy:

Core Properties

Data Management

TVirtualData
The virtual data source providing content to the grid. This can be any descendant of TVirtualData including database sources, arrays, lists, or custom data providers.
TComponent
Reference to a component that provides data, typically a TDataSource for database connectivity.
TRowGroup
The main row group that contains all grid data. This is the top-level group in master-detail hierarchies.
TRowGroup
The currently focused row group. In a simple grid, this is the same as Root. In master-detail grids, this represents the active detail level.

Visual Structure

TTextRender
Defines the rendering properties for grid cells including font, colors, alignment, and padding.
TColumns
The collection of columns defining the grid structure. Each column specifies how data is displayed and edited.
TRows
Row configuration including default height, alternating row colors, and row selection behavior.
TColumnHeaderBand
The main column header band configuration.
TGridBands
Collection of additional header bands displayed above the grid.
Collection of footer bands displayed below the grid.
TIndicator
Configuration for the row indicator column showing current row and edit state.
TMargins
Margins around the grid content area.

Editing

TGridEditing
Comprehensive editing configuration including:
  • Active - Whether an editor is currently visible
  • AlwaysVisible - Keep editor always visible
  • AutoEdit - Start editing on keypress
  • DoubleClick - Require double-click to edit
  • EnterKey - Behavior when Enter is pressed (NextCell, NextRow, SameCell)
  • EditorClass - Custom editor class
Boolean
default:"False"
Global read-only flag. When True, all cells are non-editable regardless of column settings.

Selection

TGridSelection
Current selection in the grid including:
  • Selected cell coordinates
  • Selected rows
  • Selected range

Public Methods

Display and Rendering

procedure
Renders the grid content. Override this method in derived classes to customize rendering.Signature:
function
Returns the available width for grid content, excluding scrollbars and margins.Signature:
Returns: Available width in pixels
function
Returns the available height for grid content, excluding scrollbars and margins.Signature:
Returns: Available height in pixels

Data Operations

procedure
Refreshes the grid display from the data source. Call this when the underlying data has changed.Signature:
function
Determines if a row can be expanded to show detail data.Signature:
Parameters:
  • Sender - The render object requesting expansion
  • ARow - Row index to check
Returns: True if the row has expandable detail data

Clipboard Operations

procedure
Copies the selected cells to the clipboard in tab-delimited format.Signature:
Parameters:
  • ASelection - Optional specific selection to copy (uses current selection if nil)
procedure
Pastes clipboard content into the selected cells.Signature:

Utility Methods

procedure
Copies all properties from another grid instance.Signature:
procedure
Called after the component is loaded from a stream (DFM/FMX file). Override to perform post-load initialization.Signature:
procedure
Handles mouse leave events. Call when the mouse cursor leaves the grid area.Signature:

Protected Methods

These methods are available for descendant classes and advanced customization.

Editor Management

procedure
Initiates cell editing for the specified column and row.Signature:
Parameters:
  • AColumn - Column to edit
  • ARow - Row index to edit
  • AutoEdit - Optional initial text for auto-edit mode
procedure
Stops cell editing and commits changes.Signature:
procedure
Cancels cell editing without committing changes.Signature:

Scrolling

procedure
Called when horizontal scroll position changes.Signature:
procedure
Called when vertical scroll position changes.Signature:
procedure
Validates and adjusts scroll positions to stay within valid bounds.Signature:

Data Events

procedure
Called when the data source changes or is refreshed.Signature:

Input Handling

procedure
Processes keyboard input.Signature:
procedure
Processes mouse input.Signature:

Events

TNotifyEvent
Fired after the grid is painted. Use for custom post-rendering operations.
TNotifyEvent
Fired when the selection changes.

Example: Custom Grid Implementation

See Also

TTeeGrid

Main grid component for VCL and FMX

TVirtualData

Abstract data interface