[Lazarus] Should StringGrid1.Clear clear the fixed rows / columns?

Jesus Reyes jesusrmx at yahoo.com.mx
Mon Aug 1 19:39:42 CEST 2011



--- El lun 1-ago-11, Alexander Klenin <klenin at gmail.com> escribió:

> De: Alexander Klenin <klenin at gmail.com>
> Asunto: Re: [Lazarus] Should StringGrid1.Clear clear the fixed rows / columns?
> A: "Lazarus mailing list" <lazarus at lists.lazarus.freepascal.org>
> Fecha: lunes, 1 de agosto de 2011, 2:25
> On Mon, Aug 1, 2011 at 18:13, Graeme
> Geldenhuys <graemeg.lists at gmail.com>
> wrote:
> > On 08/01/2011 03:10 AM, John Repucci wrote:
> >> I have a fixed row in my SG with the titles for
> the columns, but when I
> >> do a SG.clear, the fixed rows are deleted.
> >
> > I have raised that issue too. I believe what you have
> to do, is set the
> > RowCount property to equal FixedRowCount - instead of
> calling Clear.
> >
> > That kind of defeats the purpose of Clear, but hey
> it's Delphi
> > compatible, so who cares. ;-)
> >

I do care :).

Well I don't in this case as Delphi grids do not implement a clear method :D so this is not a compatibility problem, or is it?.

IIRC the problem you had with clear method is that after the clear you wanted the grid remembered your (fixed)cols/(fixed)rows layout. That was not planned for a cleared grid, because AFAIK, clear means dump everything, for example for a listbox means remove the items, not empty the items, then why should it remember it? however it seemed a good to have feature and I implemented it.

However, now you seem to suggest that calling clear should only mean clear the non fixed cells?, in this situation, if somebody has a grid with 2 fixed rows and 1 fixed column which was setup at design time with right titles, what should happen on grid.clear?, delete columns or rows? or just the non-fixed cells? At least I never seen a grid with just fixed cols/rows and no normal cells.

That is why "clear" is supposed to remove cols/rows and "clean" only cell content. Before anything, Delphi grids do not implement (that I know) a clean method, so this is not (or, not everything is) a compatibility problem :D

> 
> Adding optional parameter "AClearFixed: Boolean = true" to
> Clear
> may help without comprimising compatibility

That would solve a nonexistent problem, no need to implement something to remedy it.

> 
> -- 
> Alexander S. Klenin
> 

Jesus Reyes A.




More information about the Lazarus mailing list