mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:59:17 +02:00
fix col,row out of bounds (from jesus)
git-svn-id: trunk@4990 -
This commit is contained in:
parent
6b62d5e5ac
commit
751585c69a
@ -294,6 +294,7 @@ type
|
|||||||
procedure AdjustCount(IsColumn:Boolean; OldValue, NewValue:Integer);
|
procedure AdjustCount(IsColumn:Boolean; OldValue, NewValue:Integer);
|
||||||
procedure CacheVisibleGrid;
|
procedure CacheVisibleGrid;
|
||||||
procedure CheckFixedCount(aCol,aRow,aFCol,aFRow: Integer);
|
procedure CheckFixedCount(aCol,aRow,aFCol,aFRow: Integer);
|
||||||
|
procedure CheckCount(aNewColCount, aNewRowCount: Integer);
|
||||||
function doColSizing(X,Y: Integer): Boolean;
|
function doColSizing(X,Y: Integer): Boolean;
|
||||||
function doRowSizing(X,Y: Integer): Boolean;
|
function doRowSizing(X,Y: Integer): Boolean;
|
||||||
procedure doColMoving(X,Y: Integer);
|
procedure doColMoving(X,Y: Integer);
|
||||||
@ -913,6 +914,7 @@ var
|
|||||||
OldCount: integer;
|
OldCount: integer;
|
||||||
begin
|
begin
|
||||||
if IsColumn then begin
|
if IsColumn then begin
|
||||||
|
|
||||||
AddDel(FCols, NewValue);
|
AddDel(FCols, NewValue);
|
||||||
FGCache.AccumWidth.Count:=NewValue;
|
FGCache.AccumWidth.Count:=NewValue;
|
||||||
OldCount:=RowCount;
|
OldCount:=RowCount;
|
||||||
@ -952,6 +954,7 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
OldC:=FCols.Count;
|
OldC:=FCols.Count;
|
||||||
CheckFixedCount(Valor, RowCount, FFixedCols, FFixedRows);
|
CheckFixedCount(Valor, RowCount, FFixedCols, FFixedRows);
|
||||||
|
CheckCount(Valor, RowCount);
|
||||||
AdjustCount(True, OldC, Valor);
|
AdjustCount(True, OldC, Valor);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -966,6 +969,7 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
OldR:=FRows.Count;
|
OldR:=FRows.Count;
|
||||||
CheckFixedCount(ColCount, Valor, FFixedCols, FFixedRows);
|
CheckFixedCount(ColCount, Valor, FFixedCols, FFixedRows);
|
||||||
|
CheckCount(ColCount, Valor);
|
||||||
AdjustCount(False, OldR, Valor);
|
AdjustCount(False, OldR, Valor);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2036,6 +2040,20 @@ begin
|
|||||||
raise EGridException.Create(rsFixedRowsTooBig);
|
raise EGridException.Create(rsFixedRowsTooBig);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomGrid.CheckCount(aNewColCount, aNewRowCount: Integer);
|
||||||
|
var
|
||||||
|
NewCol,NewRow: Integer;
|
||||||
|
begin
|
||||||
|
if HandleAllocated then begin
|
||||||
|
if Col >= aNewColCount then NewCol := aNewColCount-1
|
||||||
|
else NewCol := Col;
|
||||||
|
if Row >= aNewRowCount then NewRow := aNewRowCount-1
|
||||||
|
else NewRow := Row;
|
||||||
|
if (NewCol>=0) and (NewRow>=0) and ((NewCol <> Col) or (NewRow <> Row)) then
|
||||||
|
MoveNextSelectable(false, NewCol, NewRow);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ Save to the cache the current visible grid (excluding fixed cells) }
|
{ Save to the cache the current visible grid (excluding fixed cells) }
|
||||||
procedure TCustomGrid.CacheVisibleGrid;
|
procedure TCustomGrid.CacheVisibleGrid;
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user