This tutorial works with both VCL and FireMonkey frameworks. Code examples show both variants where they differ.
Prerequisites
Before you begin, make sure you have:- RAD Studio, Delphi, C++ Builder, or Lazarus installed
- TeeGrid packages installed (see Installation)
- A new VCL or FireMonkey application
Create Your First Grid
1
Add TeeGrid to your form
- VCL
- FireMonkey
- Open the Tool Palette in RAD Studio or Delphi
- Find TTeeGrid in the TeeGrid category
- Drop it onto your form
- Resize it to fill the form or use
Align := alClient
uses clause:2
Define your data structure
Create a simple record or class to hold your data:You can also use classes instead of records. TeeGrid works with both.
3
Create and populate data
Create an array or list and fill it with data:
Using TList instead of TArray
Using TList instead of TArray
You can also use
TList<TPerson>:4
Bind data to the grid
Connect your data to TeeGrid using a virtual data adapter:That’s it! Run your application and you’ll see a grid with 4 columns (Name, Age, Email, City) and 10 rows.
TeeGrid automatically creates columns from your record’s fields using RTTI (Runtime Type Information). No manual column setup required!
Customize Your Grid
Now let’s add some common customizations:Enable Cell Editing
Add Row Alternating Colors
Customize Column Appearance
Enable Sorting
Complete Example
Here’s a complete working example that creates a grid with sample data:- VCL
- FireMonkey
Next Steps
Now that you have a working grid, explore more features:Data Binding
Learn about different data sources (DataSets, arrays, lists, custom)
Cell Editing
Add custom editors, validation, and edit events
Themes
Customize the visual appearance with themes
Examples
Browse complete working examples
Common Issues
Columns are not showing
Columns are not showing
Make sure you’re using a data type (record or class) with public fields or published properties. TeeGrid uses RTTI to discover columns automatically.
Grid is empty
Grid is empty
Check that:
- You assigned data to
TeeGrid1.Data - Your data array/list contains items
- You called
Create()on the virtual data adapter
Cannot edit cells
Cannot edit cells
To enable editing:
- Set
TeeGrid1.ReadOnly := False - Make sure individual columns aren’t read-only
- The data type must support writing (not const)
What You’ve Learned
- How to add TTeeGrid to a form
- How to create and bind data using arrays
- How to enable basic features like editing and sorting
- How to customize appearance with alternating row colors
