TAsDBGrid Component
Author: Yury B. Astafyev, Russian Federation

TAvDBGrid - Grid with multi-level hierarchical titles

Site update:

23 Jul 2020

Contact:

e-mail:
сontact@forpostsoft.ru

TAvDBGrid Component

TAvDBGrid is a software component for Delphi IDE. TAvDBGrid inherits from TCustomDBGrid, a Delphi VCL component. Compared to its parent, TAvDBGrid provides the following additional features:

  • Multi-level hierarchical title support with interactive design-time titles;
  • Automatic striped background for even and odd rows ("Zebra" brightness pattern);
  • Automatic column width adjustment within the component.

Demo Video « TAvDBGrid Component»

Working with Hierarchical Titles in TAvDBGrid

Hierarchical titles are added, edited and deleted using the context menu commands of the component.

To add a title, use the following three steps. First, select Mark columns for title in the con-text menu (Fig. 1).


Fig. 1. Switching to selection mode to create a title.

Second, select titles by right-clicking them to create a new title above. Selected titles are high-lighted (Fig. 2).


Fig. 2. Title-8 and Title-9 are selected. New title will be created on top of them.

Third, select Create title in the context menu. A new title will be created above the selected ones (Fig. 3).


Fig. 3. New Title-10 is created on top of Title-8 and Title-9.

Left-clicking any of TAvDBGrid titles displays the title as recessed, and its properties will appear in the Object Inspector (Fig. 4). Another click on the same or any other title, component of the form, or the form itself will return the title to its normal state.


Fig. 4. Title-9 properties displayed in Object Inspector.

To add a column, select Add/Insert column in the context menu. Actual command name and its submenus are varied dynamically depending on the position of the active title in the overall struc-ture of the header.



Fig. 5. Adding a column under Title-10.

New column is inserted to the left of the active (recessed) column, or at the rightmost if no column is active.


To remove a title from the header, select the title to activate it, open context menu and select Re-move title.



Fig. 6. Removing Title-9.

Enabling Automatic Column Width Adjustment within Component

TAvDBGrid supports automatic column width adjustment, ensuring all columns are visible and span the full width of the component. To use this feature, set the ColsStretch property to tcAllStretch or tcRightStretch.

Fig. 7 illustrates automatic width adjustment: columns shrink and expand along with the compo-nent. When a single column's width is changed, the other columns are also adjusted accordingly.


Fig. 7. Automatic width adjustment.

Enabling Striped "Zebra"- Pattern Background

Automatic striped background for even and odd data rows is controlled by the property: FonZebra : boolean;

When FonZebra is set to True, striped background is displayed (Fig. 1 to 7). When FonZebra is set to False, formed a solid background is determined by the color of the columns (Fig. 8).


Fig. 8. The way TAvDBGrid appears with FonZebra = False.

Component's icon

To component TAvDBGrid in Tool Palette Delphi IDE corresponds following icon -


Copyright © 2011 Yury Astafyev