Skip to main content

TcxGridDBColumn Class

A column in a data-aware grid Table View.

Declaration

TcxGridDBColumn = class(
    TcxGridColumn
)

Remarks

A column in a data-aware Table View is designed to display values from a dataset field. Use the DataBinding property to bind a data-aware column to data.

VCL Data Grid: A Table View Column Example

In-Place Editors

A column can use any editor shipped with the ExpressEditors Library as an in-place editor for cell edit operations. An in-place editor instance exists (and, therefore, consumes memory and other system resources, such as a WinAPI handle) only when a column cell is being edited. Otherwise, the column displays a static editor image for resource usage optimization.

To switch between available editors, you can use the PropertiesClassName or PropertiesClass property. Use the Properties property to configure the in-place editor associated with the column.

Default In-Place Editor and Data Types

When PropertiesClassName and PropertiesClass properties are unspecified, the data type of the underlying dataset field determines the active in-place editor according to the following table:

Dataset Field Type Default In-Place Editor Description
ftBoolean TcxCheckBox A check box editor with support for three states.
ftCurrency, ftBCD, and ftFMTBcd TcxCurrencyEdit A numeric editor for currency values.
ftDate and ftDateTime TcxDateEdit A date editor with a drop-down calendar.
ftTime TcxTimeEdit A spin editor for time values.
ftBytes, ftVarBytes, ftBlob, ftFmtMemo, ftParadoxOle, ftDBaseOle, and ftTypedBinary TcxBlobEdit A Binary Large Object (BLOB) editor.
ftMemo TcxMemo A multi-line editor for plain text.
ftGraphic TcxImage An editor designed to display images.
All other types TcxMaskEdit A single-line text editor with support for input masks.

Main API Members

The list below outlines key members of the TcxGridDBColumn class that allow you to configure columns in a data-aware grid Table View.

Example: Create a Data-Aware Column

The following code example creates a data-aware column, associates it with a field in the dataset bound to the parent grid Table View, sets a single-line text editor as the column’s in-place editor, and customizes editor settings:

uses cxTextEdit;
// ...
var
  AColumn: TcxGridDBColumn;
  ATextEditProperties: TcxTextEditProperties;
begin
  AColumn := cxGrid1DBTableView1.CreateColumn;  // Creates a new data-aware column
  AColumn.DataBinding.FieldName := 'ContactName'; // Binds the created column to the "ContactName" field
  AColumn.PropertiesClass := TcxTextEditProperties; // Assigns an in-place single-line text editor
  ATextEditProperties := AColumn.Properties as TcxTextEditProperties;
  ATextEditProperties.Nullstring := 'Add a contact name'; // Prompts users to enter a contact name
  ATextEditProperties.UseNullString := True;  // Displays the defined text hint in an empty editor
  ATextEditProperties.MaxLength := 30;  // Limits the maximum contact name length
end;

Direct TcxGridDBColumn Class References

The following public API members reference a TcxGridDBColumn object:

TcxGridDBTableView.Columns
Provides indexed access to the collection of the View’s columns.
TcxGridDBTableView.CreateColumn
Creates and adds a column to the View’s Columns collection.
TcxGridDBTableView.GetColumnByFieldName
Locates the column displaying a particular field’s values.
See Also