Delphi Programming

and software in general.

Saturday, August 2, 2008

Reusable Grid View - part 4 - Code Complete

The first part of FDCLib (Free Delphi Code Library) is out.

It contains the reusable grid view controller, a small color utility unit and three very simple demos.

The code is currently only tested under Delphi 2007, and the color utility unit implements a record with methods, so I guess that breaks older versions, but it is easy to change. I'll probably add some conditional code for compatibility later.

Details about versions downloading can always be found at You can download a .zip file or grab it with SVN from the repository at SourceForge. I haven't created a download package on SourceForge yet, but that is coming as well.

The Grid Demos
There are three very simple demos included in the demo/DemoFDCLib project. I'd like to add some more later, but I think they demonstrate the basic functionality for now.

DemoFrameGridViewController contains the interactive bits (ie the TStringGrid, etc.)

DemoNumbersViewClass show a series of numbers and their value squared, and also show how to use a custom static column color.

DemoColorsViewClass shows how to implement a procedural color and contains $FFFFFF rows :) Loading time is nonexistant.

DemoDirectoryClass is a small utility class that populate a TStringList from a directory path with wildcards. DemoDirectoryViewClass implements the grid controller for showing content from that extended string list. The default directory in the demo is "%temp%\*", but feel free to experiment with changing it in the edit box.


  1. Thank you for this elegant demo.

  2. Positive feedback is always appreciated :)

    Please note that there are several things that can (and probably should) be added to the class before it becomes a full-fledged grid, such as sorting, column moving and maybe even cell editing. My most important point was to demonstrate how you can expand functionality with lose couplings between objects and with limited use of inheritance.