Skip to main content

Overview

TeeGrid for Lazarus provides cross-platform grid components using the FreePascal compiler and LCL (Lazarus Component Library). Share the same VCL codebase across Windows, Linux, macOS, and other FreePascal-supported platforms.
Lazarus uses the same VCLTee.Grid unit as Delphi VCL, with FPC-specific conditional compilation for compatibility.

Installation

Setting Up TeeGrid in Lazarus

1

Clone the TeeGrid repository

2

Open your Lazarus project

Launch Lazarus IDE and open your project or create a new application.
3

Add units to your uses clause

4

Configure library paths

Add TeeGrid source directories to your project search path:
  • Project → Project Options → Compiler Options → Paths
  • Add to “Other unit files”:
    • TeeGrid/src/delphi/VCL
    • TeeGrid/src/delphi

Platform Support

Lazarus with TeeGrid supports multiple platforms:

Windows

  • Win32
  • Win64
  • Full GDI support

Linux

  • x86_64
  • ARM
  • GTK2/GTK3/Qt5 widgets

macOS

  • Intel (x86_64)
  • Apple Silicon (AArch64)
  • Cocoa widget set

Additional Platforms

  • FreeBSD: x86_64, i386
  • Raspberry Pi: ARM Linux
  • Other Unix: Most POSIX-compatible systems

FreePascal Compatibility

Conditional Compilation

TeeGrid uses {$IFDEF FPC} directives for FreePascal compatibility:
VCLTee.Grid.pas

Object Pascal Mode

Enable Object Pascal mode for Delphi compatibility:
What this does:
  • {$mode objfpc}: Object Pascal mode (Delphi-compatible)
  • {$H+}: Long strings (AnsiString) by default

Architecture

Shared VCL Implementation

Lazarus uses the same classes as Delphi VCL:

LCL-Specific Members

VCLTee.Grid.pas:104

Rendering

LCL Painter

Uses the same TGDIPainter with LCL adaptations:
VCLTee.Painter.pas
Rendering features:
  • Native LCL canvas drawing
  • Platform-specific optimizations
  • GTK/Qt/Cocoa widget rendering

Database Integration

Supported Database Components

Lazarus TeeGrid works with various database components:

Complete Database Example

unit_main.pas

Cell Editing

LCL Editor Controls

Lazarus supports standard LCL editor controls:

Platform-Specific Editors

Some editors may behave differently across widget sets:
Editor appearance and behavior may vary between GTK2, GTK3, Qt5, and Cocoa widget sets. Test on your target platforms.

Messages and Events

LCL Messages

Lazarus uses LCL message types:
VCLTee.Grid.pas:129
Common LCL messages:
  • LM_SIZE - Component resized
  • LM_PAINT - Repaint needed
  • LM_SETFOCUS - Component gained focus
  • LM_KILLFOCUS - Component lost focus

Scrolling

LCL ScrollBars

Scrollbars work the same as in VCL:

Themes

LCL Widget Themes

TeeGrid adapts to the native LCL theme:

Platform Native Appearance

TeeGrid automatically uses GTK theme colors and fonts.

Master-Detail Grids

Two-Grid Master-Detail

unit_masterdetail_twogrids.pas

Performance Optimization

Lazarus-Specific Tips

Choose the appropriate widget set for your target platform:
  • GTK2: Fastest on older Linux systems
  • GTK3: Modern Linux with better HiDPI support
  • Qt5: Best cross-platform consistency
  • Cocoa: Required for macOS
  • Win32/Win64: Native Windows performance
Can improve performance on some platforms.
Critical for smooth scrolling with database datasets.

Common Issues

Troubleshooting

Problem: Fatal: Cannot find VCLTee.Grid used by...Solution:
  1. Add TeeGrid source paths to Project Options → Paths
  2. Add: TeeGrid/src/delphi/VCL and TeeGrid/src/delphi
  3. Rebuild project
Problem: Incompatible type for arg no. 1: Got "TDataSource", expected "TComponent"Solution:
Problem: Crashes on GTK2/GTK3Solution:
  1. Check for nil objects before accessing
  2. Use try-finally blocks for resource cleanup
  3. Test with different widget sets (GTK2 vs GTK3)
Problem: Blurry text or small controls on HiDPI screensSolution:

Complete Example

unit_main.pas

Deployment

Building for Distribution

1

Set build mode to Release

Project → Project Options → Compiler Options → Build Mode → Release
2

Configure optimization

  • Optimization level: -O3
  • Smart linking: Enabled
  • Strip symbols: Enabled (for smaller executable)
3

Build executable

4

Include required libraries

Linux:
  • GTK2/GTK3 libraries (usually pre-installed)
  • Database client libraries if needed
macOS:
  • Application bundle with frameworks
Windows:
  • Usually no extra DLLs needed (static linking)

See Also

VCL Framework

Native Windows VCL implementation

FireMonkey Framework

Cross-platform FMX alternative

Data Binding

Connect to datasets and other data sources

Cell Editing

Editor controls and customization