[Lazarus] DBGrid columns shrunk to fit data

Luca Olivetti luca at wetron.es
Thu Jun 18 12:12:54 CEST 2009


En/na Graeme Geldenhuys ha escrit:
> Luca Olivetti wrote:
>> TRxDBGrid can do it, however (and obviously) it has to iterate through
>> all the records to find the longest one.
> 
> Well, it has to iterate through all the records anyway to paint the data
> in the cells. So the TDBGrid could simply keep track of the longest cell
> value in each column and size the width of each column appropriately.
> 
> So does this mean the TDBGrid cannot or doesn't have this feature at the
> moment?

I don't think it has

> 
> 
>> BTW, I'm all for having all the nice options in TRxDbGrid in the
>> standard TDBGrid (though I'm not sure the license allows to copy them
>> verbatim), my suggestion is only if you want a solution *now*
> 
> It's definitely not a TRxDBGrid specific feature. FlameRobin has that
> feature in its grid is definitely not written in Object Pascal. HTML
> tables also have that feature by default and again I don't know of a
> single web browser written in Object Pascal (excluding HTML viewing
> components).
> 
> So I cannot see any license issues implementing this in TDBGrid.

My comment was about verbatim copying of /code/ from TRxDBGrid to TDBGrid

Bye
-- 
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004 (Ext.133)  Fax +34 93 5883007




More information about the Lazarus mailing list