Skip to main content

Overview

The TGridEditing class manages how cells are edited in a TeeGrid. It provides comprehensive control over when and how editing begins, what editor controls are used, and how user input is processed.

Class Hierarchy

Key Features

  • Auto-edit mode for immediate editing
  • Double-click or single-click activation
  • Always-visible editors
  • Custom editor class support per column
  • Configurable Enter key behavior
  • Text selection options

Properties

Active

Indicates whether an editor is currently active and visible. Default: False Note: This property is typically set internally by the grid. Read this property to check if editing is in progress. Example:

AlwaysVisible

When True, the editor control remains visible for the selected cell at all times. Default: False Example:

AutoEdit

When True, typing in a selected cell immediately starts editing mode without requiring a double-click or F2 key. Default: False Example:

DoubleClick

When True, double-clicking a cell starts edit mode. When False, a single click is sufficient. Default: True Example:

EnterKey

Determines what happens when the Enter key is pressed while editing. Type: TEditingEnter Values:
  • TEditingEnter.NextCell - Move to the next cell in the current row
  • TEditingEnter.NextRow - Move to the same column in the next row
  • TEditingEnter.SameCell - Stay in the current cell
Default: TEditingEnter.NextCell Example:

EditorClass

The default editor control class to use for editing cells. Can be overridden per column. Default: TEdit (or platform equivalent) Example:

Text

Configures text editing behavior, such as whether text is selected when editing begins. Example:

Methods

Constructor Create

Creates a new TGridEditing instance. Parameters:
  • AChanged: Event handler called when editing properties change

Assign

Copies editing properties from another object. Parameters:
  • Source: The source object to copy from
Example:

ClassOf

Returns the editor class to use for a specific column. Returns the column’s custom editor class if set, otherwise returns the default EditorClass. Parameters:
  • AColumn: The column to get the editor class for
Returns: The TClass of the editor control Example:

TTextEditing Class

The TTextEditing class configures text-specific editing behavior.

Properties

Selected

When True, all text in the editor is selected when editing begins. Default: True

TEditingEnter Enumeration

Defines the behavior when the Enter key is pressed during editing.
  • NextCell - Move to the next editable cell in the current row
  • NextRow - Move to the same column in the next row
  • SameCell - Stay in the current cell (multi-line editing)

Usage Examples

Basic Editing Configuration

Always-Visible Editor

Excel-Like Navigation

Custom Editor for Specific Column

Disable Editing for Entire Grid

Disable Editing for Specific Column

Checking Edit State

Starting Edit Programmatically

Multi-Line Text Editing

Conditional Editing

Editor Workflow

The typical workflow for cell editing:
  1. Activation - User double-clicks (or single-clicks) a cell, or types when AutoEdit is enabled
  2. Editor Display - Grid creates and displays the appropriate editor control
  3. Editing - User modifies the cell content
  4. Commit - User presses Enter or Tab, or clicks another cell
  5. Validation - Grid validates and saves the new value
  6. Navigation - Based on EnterKey setting, focus moves to next cell

Important Notes

Editing only works on columns that have ReadOnly set to False. The grid-level ReadOnly property overrides all column settings.
When using custom editor classes, ensure they are properly registered and compatible with your application framework (VCL or FireMonkey).
For data-bound grids connected to TDataSet, the grid automatically handles data posting and cancellation. For virtual data sources, you may need to implement custom save logic.

See Also