Understanding Bands
A band is aTGridBand object - a rectangle with support for:
- Mouse hover highlighting
- Custom height
- Click events
- Custom rendering
- Headers - Column headers and grid titles
- Footers - Totals and summary information
- Rows - The data rows themselves
Band Properties
All bands share these properties:Headers Collection
Add multiple header bands:Footer Collection
Add multiple footer bands:AddText Helper Method
Quickly add text bands:TTextBand
TTextBand is a band that displays text:
Column Header Band
The main header showing column names is a specialTColumnHeaderBand:
Custom Band Classes
Create a custom band by inheriting fromTGridBand:
Band Events
OnClick
Handle band clicks:Floating Bands
Make bands float over content:Band Height Modes
Fixed Height
Percentage Height
Auto Height
For text bands, height can auto-calculate based on text:Multiple Headers Example
Create a grid with title and column headers:Footer with Totals
Add calculated totals in footer:Bands in Sub-Grids
EachTRowGroup has its own headers and footers:
Band Spacing
Hiding/Showing Bands
Band Lines
Add borders to bands:Best Practices
- Use
AddText()for simple text headers/footers - Keep band heights reasonable (20-40 pixels for text)
- Use percentage heights sparingly, as they change with window size
- Group related information in separate bands
- Use consistent colors for visual hierarchy
- Consider
Floating := Truefor overlay effects - Remember that each sub-grid has its own header/footer collections
- Use custom band classes for complex rendering needs
