[GRID.PAS] Bug inside VCL Grids
Hello,
I found two bugs inside the VCL, for the function InvalidateRow &
InvalidateCol. This error can not redisplay the visible cell in you grid.
The Original source code is
procedure TCustomGrid.InvalidateCol(ACol: Longint);
var
Rect: TGridRect;
begin
if not HandleAllocated then Exit;
Rect.Top := 0;
Rect.Left := ACol;
Rect.Bottom := VisibleRowCount+1;
Rect.Right := ACol;
InvalidateRect(Rect);
end;
You must change it with
procedure TCustomGrid.InvalidateCol(ACol: Longint);
var
Rect: TGridRect;
begin
if not HandleAllocated then Exit;
if FixedRows > 0 then
begin
Rect.Top := 0;
Rect.Left := ACol;
Rect.Bottom := FixedRows-1;
Rect.Right := ACol;
InvalidateRect(Rect);
end
Rect.Top := TopRow;
Rect.Left := ACol;
Rect.Bottom := TopRow+VisibleRowCount+1;
Rect.Right := ACol;
InvalidateRect(Rect);
end;
Original Source Code is
procedure TCustomGrid.InvalidateRow(ARow: Longint);
var
Rect: TGridRect;
begin
if not HandleAllocated then Exit;
Rect.Top := ARow;
Rect.Left := 0;
Rect.Bottom := ARow;
Rect.Right := VisibleColCount+1;
InvalidateRect(Rect);
end;
You must change it with
procedure TCustomGrid.InvalidateRow(ARow: Longint);
var
Rect: TGridRect;
begin
if not HandleAllocated then Exit;
if FixedCols > 0 then
begin
Rect.Top := ARow;
Rect.Left := 0;
Rect.Bottom := ARow;
Rect.Right := FixedCols-1;
InvalidateRect(Rect);
end;
Rect.Top := ARow;
Rect.Left := LeftCol;
Rect.Bottom := ARow;
Rect.Right := LeftCol+VisibleColCount+1;
InvalidateRect(Rect);
end;
It will be great that the VCL include a patch for that.
Cheers
Emmanuel