[fpc-devel] TStringGrid behaviour
Birger Jansen
birger at cnoc.nl
Wed Oct 27 14:32:54 CEST 2010
Hi all,
I have the following code that throws an error in FPC and runs fine in Delphi:
procedure TForm1.BitBtn1Click(Sender: TObject);
var
MyStringGrid: TStringGrid;
begin
MyStringGrid := TStringGrid.Create(nil);
try
MyStringGrid.RowCount := 0;
MyStringGrid.RowHeights[0] := 1;
finally
MyStringGrid.Free;
end;
end;
Delphi checks if the grid has at least
In FPC there is no check on RowCount before the height is set, resulting in a List index(0) out of bounds exception. Although it is correct, it is annoying :-)
It can be fixed by adding something like this to the beginning of TCustomGrid.Setrowheights:
if ARow <= FRows.Count then EXIT;
Shall I file a report for this?
Kind regards,
Birger Jansen
More information about the fpc-devel
mailing list