[Lazarus] How to get rid of text in (0,0) in StringGrid?

Jesus Reyes jesusrmx at yahoo.com.mx
Fri Feb 5 22:34:24 CET 2010


--- El vie 5-feb-10, Flávio Etrusco <flavio.etrusco at gmail.com> escribió:


> your problem. I guess the code
> is missing some check(s) for "csDesigning in
> ComponentState"...

I don't understand, exactly where is it missing?

> But actually, I can't quite follow the logic in the code:
> 
> ...
> OldCount:=RowCount;
>     if (OldValue=0)and(NewValue>=0) then
> begin
>       FTopLeft.X:=FFixedCols;
>       if RowCount=0 then begin
>         if Columns.Enabled then
>           FFixedRows := 1
>         else
>           FFixedRows := 0;
>         FTopLeft.Y:=FFixedRows;
>        
> //DebugLn('TCustomGrid.AdjustCount A ',DbgSName(Self),'
> FTopLeft=',dbgs(FTopLeft));
>         AddDel(FRows, 1);
>         FGCache.AccumHeight.Count:=1;
>       end;
>     end;
> ^^^

The logic is: given a empty grid and if developer adds at least one column then adds also a row so the column can be actually seen in grid for the rest, see my final note. But the question might yet be, why this code handling column count changes occur when adding rows to an empty grid?, the answer is that adding rows without columns do not make sense, you have to have at least one column so you see the rows :).

> On Fri, Feb 5, 2010 at 10:14 AM, Paul van Helden <paul at planetgis.co.za>
> wrote:
> > Hi Flávio,
> >
> > I'm using a TStringGrid for a checklistbox with two
> columns and don't ever
> > want to see a title. So I set both FixedRows:=0 and
> RowCount:=0 in designer.
> > Whenever I set RowCount to something more than 0, I
> have to set FixedRows
> > back to zero again. I don't see the logic in that...
> >
> > Thanks,
> >
> > Paul.

In the above logic there is a complement: it was assumed that if there were custom columns and grid was empty and because at least a row will be added automaticaly, the developer expects to see a column title, this part of the logic is not always true as you have found :), it's fixed in r 23650.

Jesus Reyes A.


      Encuentra las mejores recetas en Yahoo! Cocina.                       
http://mx.mujer.yahoo.com/cocina/




More information about the Lazarus mailing list