From e677aae348e19122db878d3569ed1bd1eeeba6a4 Mon Sep 17 00:00:00 2001 From: jesus Date: Thu, 25 Nov 2010 20:25:17 +0000 Subject: [PATCH] LCL, fix dbgrid index out of bounds (-1) when the selected record is not the first and the dataset is closed and opened git-svn-id: trunk@28484 - --- lcl/dbgrids.pas | 4 +--- lcl/grids.pas | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lcl/dbgrids.pas b/lcl/dbgrids.pas index 82ce28cf6c..7d1d92b7cc 100644 --- a/lcl/dbgrids.pas +++ b/lcl/dbgrids.pas @@ -719,10 +719,8 @@ begin OldFixedCols := FixedCols; OldFixedRows := FixedRows; Clear; - ColCount := OldFixedCols + 1; RowCount := OldFixedRows + 1; - FixedCols := OldFixedCols; - FixedRows := OldFixedRows; + ColCount := OldFixedCols + 1; if dgIndicator in Options then ColWidths[0]:=12; end; diff --git a/lcl/grids.pas b/lcl/grids.pas index d6b0853e6c..37e4dfa8b7 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -2667,6 +2667,8 @@ begin NewColCount := FGridPropBackup.ColCount; FFixedCols := Min(FGridPropBackup.FixedColCount, NewColCount); FFixedRows := Min(FGridPropBackup.FixedRowCount, AValue); + FTopLeft.X := FFixedCols; + FTopLeft.Y := FFixedRows; // ignore backedup value of rowcount because // finally rowcount will be AValue FGridPropBackup.RowCount := AValue;