[Lazarus] DBGrid columns shrunk to fit data

Graeme Geldenhuys graemeg at opensoft.homeip.net
Thu Jun 18 11:58:07 CEST 2009


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?


> 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.


Regards,
  - Graeme -

_______________________________________________________
fpGUI - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/





More information about the Lazarus mailing list