grids.pas: a simple generic grid class.