[Lazarus] DBGrid columns shrunk to fit data

Graeme Geldenhuys graemeg at opensoft.homeip.net
Fri Jun 19 08:55:11 CEST 2009


Jesus Reyes wrote:
> 
> So what are the options?, one could ask the grid to do autosizing
> with it's limited set of records,

That was my thinking as well. If the grid only fetches and displays 10
records at a time, then start with only those 10 records - to calculate
the best fit with of each column.

As the user scrolls the grid and more data gets fetched, so the column
with calculation continues and the width adjusted. Any half descent
programmer would know not to retrieve a couple million records and try
and display it in a grid - talk about data overload! :-)

Alternatively, if the idea of columns being resized as scrolled is
disliked by most, then I think even by only using the first 10 cached
records to calculate a more sane column width is better than the huge
column widths currently in the grid. So even if the user scrolls and
some data doesn't fit, it at least means most data fits and only a
select few columns would need to be resized by the user. It's still a
lot better than having a grid and only seeing one column (very wide)
that fills the grid width and only a small about of actual text in that
column (see the screenshot of the bug report I mentioned).


> 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 :)

And it seems even worse if UTF8 charset is used in the database (I'm
using Firebird DB) and you have columns defined as CHAR(x). But I am
glad to hear I am not the only one finding this annoying.

I did a small usability study on LazDataDesktop to see if it could
replace other similar software (like FlameRobin). There was a few issues
remaining, but the grid column widths drove me nuts very quickly.


Regards,
  - Graeme -

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





More information about the Lazarus mailing list