Skip to main content

TcxGrid Class

A Data Grid control.

Declaration

TcxGrid = class(
    TcxCustomGrid
)

Remarks

The Data Grid allows you to display data as a table and in a variety of other formats. The control has multiple built-in features that allow users to shape and edit data.

VCL Data Grid: A Grid Table View Example

The control does not work with data directly. It serves as a container for Views that connect to data, display it in various formats, and implement end-user interaction. The Data Grid can contain one view or multiple views in a master-detail relationship. To manage view hierarchies, you can use grid levels.

Available Views

Table View (unbound, bound, and Server Mode
This View displays data in a table (in a manner similar to a standard VCL data grid).
Banded Table View (unbound, bound, and Server Mode)
This is an enhanced version of a Table View that supports customizable cell layout in rows. You can also join columns under higher-level headers called Bands.
Card View (unbound and bound)
This View displays records in blocks similar to contact cards.
Layout View (unbound and bound)
This View displays data records as cards with a customizable layout.
Chart View (unbound and bound)
This View allows you to display data as bar, column, line, area, and pie diagrams. A Chart View displays only one diagram at a time.
WinExplorer View (unbound and bound)
This view supports the same display modes as those found in Microsoft Windows Explorer: Small, Medium, Large, Extra-Large, List, Tiles, and Content.

Bind to Data

A View uses a data controller to load data from the specified source. Each View supports different data controllers designed to work in different data access modes:

Bound
A grid View connects to a dataset and loads all data records into memory. All data shaping operations are done on the client machine.
Unbound
A grid View is not bound to a dataset and manages data preloaded into a data controller.
Provider
A grid View loads data from a custom data source on demand.
Server
A grid View loads data from a supported database on demand. The current server mode implementation supports Microsoft SQL Server, Microsoft Access, MySQL, Firebird, InterBase (except for query-based server mode data sources), Oracle, Advantage, PostgreSQL, and SQLite databases.

Main API Members

The list below outlines key members of the TcxGrid class. These members allow you to configure general Data Grid control settings and manage grid Views/levels.

Appearance Settings

Images
Specifies the image source for grid level tabs and column headers.
LevelTabs
Provides access to grid level tab appearance settings.
LockedStateImageOptions
Provides access to Locked View image settings.
LookAndFeel
Provides access to look & feel settings at the Data Grid control level.
OnPrepareLockedStateImage
Allows you to custom draw a Locked View image.
RootLevelOptions | RootLevelStyles
Allow you to customize grid level appearance at the root hierarchy level.

Grid Level Management

ActiveLevel
Specifies the active root grid level.
Levels
Provides access to the root grid level collection.

Grid View Management

ActiveView
Provides access to the grid View associated with the active root level.
CreateView
Creates a new grid View of any supported type.
ViewCount
Returns the number of grid Views accessible through the Views property.
Views
Provides indexed access to all created grid Views.

User Interaction APIs

Automation
Provides access to UI Automation and accessibility-related settings.[1]
FocusedView
Allows you to move focus between grid Views.
OnActiveTabChanged | OnActiveTabChangedEx | OnFocusedViewChanged
Allow you to respond to user navigation between grid Views.
TabStop
Specifies if users can press Tab to focus the Data Grid control.

General-Purpose API Members

BeginUpdate | EndUpdate | CancelUpdate
Allow you to avoid excessive redraw operations during batch data and appearance changes.
Invalidate | LayoutChanged | SizeChanged
Redraw the Data Grid control on demand.
OnLayoutChanged
Allows you to execute custom code in response to grid layout changes.

Get Started

The following tutorials help you get acquainted with the Data Grid control and its Views:

Table View
This tutorial describes how to add a Data Grid control to your application and set up a Table View display style.
Banded Table View
This tutorial describes how to add a Data Grid control, specify data connections, and adjust appearance settings in a Banded Table View.
Footnotes
  1. Each grid Table View and column has its own Automation property (TcxGridTableView.Automation and TcxCustomGridTableItem.Automation).

See Also