Skip to main content

Overview

The TGridBands class is a collection that manages multiple TGridBand objects. Grid bands are rectangular areas within a TeeGrid that can display headers, footers, totals, or custom content. Each band supports mouse interaction, custom height, and click events.

Class Hierarchy

Properties

Visible

Controls whether the band collection is visible in the grid. Default: True Example:

Items

Provides indexed access to individual TGridBand objects in the collection. Parameters:
  • Index: Zero-based integer index
Example:

Floating

Determines whether bands float over grid content or occupy fixed space.

Height

The total calculated height of all bands in the collection.

Methods

Constructor Create

Creates a new TGridBands collection. Parameters:
  • AOwner: The persistent object that owns this collection
  • AChanged: Event handler called when the collection changes

Assign

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

AddText

Adds a new text band to the collection with the specified text. Parameters:
  • AText: The text to display in the band
Returns: The newly created TTextBand object Example:

CalcHeight

Calculates the total height required for all bands in the collection. Parameters:
  • APainter: The painter object used for measurement calculations
  • ATotal: The total available height

CanDisplay

Returns True if the band collection can be displayed (is visible and contains items). Returns: Boolean indicating if bands should be painted

Mouse

Handles mouse events for all bands in the collection. Parameters:
  • AState: The current mouse state (position, button, event type)
  • AWidth: The width of the band area
  • AHeight: The height of the band area

Paint

Paints all visible bands in the collection. Parameters:
  • AData: Rendering data containing painter and bounds information

TGridBand

Base class for individual bands with the following key properties:
  • Height: TBandHeight - The height of the band
  • OnClick: TNotifyEvent - Event triggered when the band is clicked
  • Visible: Boolean - Controls band visibility
  • Hover: Inherited hover support for mouse interaction

TTextBand

Specialized band for displaying text, inherits from TGridBand:
  • Text: String - The text to display
  • TextRender: TCellRender - Formatting options for the text

Usage Examples

Creating a Custom Header

Adding Multiple Bands

Handling Band Click Events

Constants

Spacing

The spacing between bands (currently fixed at 0 pixels).

See Also