cobines schrieb:
If you have a way to reproduce you should create a small project and
make a report to the bugtracker.
I have narrowed it down as far as I could now.

My form contains a simple TStringGrid.
ColCount is 3 and RowCount is 1 on startup (in object inspector).
On Click the procedure "Start" is launched:

------------------------------------------------------------
procedure TForm1.Start(Sender: TObject);
var i,j  : LongInt;

begin // TForm1.Start
Grid.Clear;
for j := 1 to 5 do
  begin
  with Grid do
     begin
     RowCount := RowCount+1;
     Cells[0,Grid.RowCount-1] := 'XXXX '+IntToStr(j);
     end;
  for i := 1 to 3 do
     begin
     if Grid.Cells[1,Grid.RowCount-1]='' then
        begin
        Grid.Cells[1,Grid.RowCount-1] := 'Test in 1';
        Grid.Cells[2,Grid.RowCount-1] := IntToStr(i);
        end
     else
        begin
        //StringGridAddRow(Grid,Grid.RowCount);
        with Grid do
           begin
           RowCount := RowCount+1;
           Cells[1,Grid.RowCount-1] := 'New in 1';
           Cells[2,Grid.RowCount-1] := IntToStr(i);
           end;
        end;
     Application.ProcessMessages;
     end;
  end;
Grid.AutoSizeColumns;
end; // TForm1.Start


procedure TForm1.GridPrepareCanvas(Sender : TObject; aCol,aRow : Integer; aState : TGridDrawState);
var MyTextStyle : TTextStyle;

begin // TForm1.GridPrepareCanvas
if (aCol=2) or (aCol=0) then
  begin
  MyTextStyle           := Grid.Canvas.TextStyle;
  MyTextStyle.Alignment := taRightJustify;
  Grid.Canvas.TextStyle := MyTextStyle;
  end;
end; // TForm1.GridPrepareCanvas
------------------------------------------------------------

The ghost column only appears if all rows and columns fit within the window for "Grid". If I leave out the "GridPrepareCanvas" the ghost column still appears but without content. If I leave out the "Application.ProcessMessages" the ghost column does not appear at all.

Anybody else who can reproduce it with the code above?


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to