You've already forked lazarus-ccr
fpspreadsheet: Scroll active grid cell back into viewport if lost by zooming process.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5239 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -42,7 +42,7 @@ object MainForm: TMainForm
|
|||||||
Font.Height = -13
|
Font.Height = -13
|
||||||
Font.Name = 'Arial'
|
Font.Name = 'Arial'
|
||||||
MouseWheelOption = mwGrid
|
MouseWheelOption = mwGrid
|
||||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goThumbTracking, goDblClickAutoSize, goSmoothScroll, goHeaderHotTracking, goCellHints]
|
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goRowSizing, goColSizing, goEditing, goThumbTracking, goDblClickAutoSize, goHeaderHotTracking, goCellHints]
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
RowCount = 101
|
RowCount = 101
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
@@ -5907,6 +5907,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsCustomWorksheetGrid.SetZoomFactor(AValue: Double);
|
procedure TsCustomWorksheetGrid.SetZoomFactor(AValue: Double);
|
||||||
|
var
|
||||||
|
c,r: Integer;
|
||||||
begin
|
begin
|
||||||
if (AValue <> GetZoomFactor) and Assigned(Worksheet) then begin
|
if (AValue <> GetZoomFactor) and Assigned(Worksheet) then begin
|
||||||
inc(FZoomLock);
|
inc(FZoomLock);
|
||||||
@@ -5916,7 +5918,23 @@ begin
|
|||||||
UpdateColWidths;
|
UpdateColWidths;
|
||||||
UpdateRowHeights;
|
UpdateRowHeights;
|
||||||
dec(FZoomLock);
|
dec(FZoomLock);
|
||||||
Invalidate;
|
|
||||||
|
// Bring active cell back into the viewport: There is a ScrollToCell but
|
||||||
|
// this method is private. It is called by SetCol/SetRow, though.
|
||||||
|
if ((Col < GCache.Visiblegrid.Left) or (Col >= GCache.VisibleGrid.Right)) and
|
||||||
|
(GCache.VisibleGrid.Left <> GCache.VisibleGrid.Right) then
|
||||||
|
begin
|
||||||
|
c := Col;
|
||||||
|
Col := c-1; // "Col" must change in order to call ScrtollToCell
|
||||||
|
Col := c;
|
||||||
|
end;
|
||||||
|
if ((Row < GCache.VisibleGrid.Top) or (Row >= GCache.VisibleGrid.Bottom)) and
|
||||||
|
(GCache.VisibleGrid.Top <> GCache.VisibleGrid.Bottom) then
|
||||||
|
begin
|
||||||
|
r := Row;
|
||||||
|
Row := r-1;
|
||||||
|
Row := r;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user