From 56fb0cb880c997533bdd3b8cfbe27fc73b2ee624 Mon Sep 17 00:00:00 2001 From: jesus Date: Fri, 10 Dec 2010 05:36:18 +0000 Subject: [PATCH] LCL, use fully visible grids calc the amount of cols or rows to scroll, issue #17882 git-svn-id: trunk@28664 - --- lcl/grids.pas | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lcl/grids.pas b/lcl/grids.pas index 5c6067a0ad..acccc8ac18 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -604,6 +604,7 @@ type PushedCell: TPoint; // Cell coords of cell being pushed PushedMouse: TPoint; // mouse Coords of the cell being pushed ClickCellPushed: boolean; // Header Cell is currently pushed? + FullVisibleGrid: TRect; // visible cells excluding partially visible cells end; type @@ -4830,6 +4831,8 @@ end; { Save to the cache the current visible grid (excluding fixed cells) } procedure TCustomGrid.CacheVisibleGrid; +var + R: TRect; begin with FGCache do begin VisibleGrid:=GetVisibleGrid; @@ -4838,6 +4841,19 @@ begin ValidCols := (top>=0) and (bottom>=Top) and (ColCount>0) and (RowCount>0); ValidGrid := ValidRows and ValidCols; end; + FullVisibleGrid := VisibleGrid; + if ValidGrid then + with FullVisibleGrid do begin + if TLColOff>0 then + Left := Min(Left+1, Right); + if TLRowOff>0 then + Top := Min(Top+1, Bottom); + R := CellRect(Right, Bottom); + if R.Right>(ClientWidth+GetBorderWidth) then + Right := Max(Right-1, Left); + if R.Bottom>(ClientHeight+GetBorderWidth) then + Bottom := Max(Bottom-1, Top); + end; end; end; @@ -6237,12 +6253,12 @@ begin end; VK_PRIOR: begin - R:=FGCache.Visiblegrid; + R:=FGCache.FullVisiblegrid; MoveSel(True, 0, R.Top-R.Bottom); end; VK_NEXT: begin - R:=FGCache.VisibleGrid; + R:=FGCache.FullVisibleGrid; MoveSel(True, 0, R.Bottom-R.Top); end; VK_HOME: