--- El jue 18-jun-09, waldo kitty <[email protected]> escribió:

> De:: waldo kitty <[email protected]>
> Asunto: Re: [Lazarus] DBGrid columns shrunk to fit data
> A: "Lazarus mailing list" <[email protected]>
> Fecha: jueves 18 de junio de 2009, 19:43
> Luca Olivetti wrote:
> > En/na Graeme Geldenhuys ha escrit:
> >> Graeme Geldenhuys wrote:
> >>> Is there an option for the DBGrid to
> automatically resize its columns to
> >>> fit the data?
> >> 
> >> 
> >> Anybody know if TDBGrid can do this? If so, what
> properties need to be set?
> >> 
> >> Here is a bug report regarding this issue. The
> report also contains two
> >> comparison images showing the difference:
> FlameRobin vs LazDataDesktop
> >> executing the exact same query and the default
> result data grid generated.
> > 
> > TRxDBGrid can do it, however (and obviously) it has to
> iterate through all the records to find the longest one.
> 
> hunh? why iterate thru? doesn't it already have to process
> each row when they come in from the server? that would be
> the time and place to do this width setting, in my old
> school procedural mindset...

The grid only knows about the records that fit in its rectangular area, for 
this limited set of records the grid could autosize columns without performing 
additional fetches. 

AFAIR the dataset caches only 10 records by default. Retrieving all records 
from dataset works only nice for some dbengine-local/remote combinations, 
nobody likes to wait too much while the grid retrievs thoudsand o millions of 
records from remote server just to find what is the best column size. Moreover, 
some databases provide cursor with forward only transversal even when grid 
could retrieve everything it doesn't have functionality to cache records 
locally. So the final decision need to be made by the programmer through 
options.

So what are the options?, one could ask the grid to do autosizing with it's 
limited set of records, another, it could use first-next to browse all records, 
it could do the later using some amount of records only, etc. Once autosizing 
is made should it try again as new records become available until eof, ....

ideas?

btw, I also found annoying to have so big column sizes, it seemed to me that 
previoulsy it didn't do this, but I know it wasn't done intentionally in the 
grid :)

Jesus Reyes A.


      ¡Obtén la mejor experiencia en la web! Descarga gratis el nuevo Internet 
Explorer 8. http://downloads.yahoo.com/ieak8/?l=mx

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to