From 4ce49481be462584a4cc51db09d605124b901b91 Mon Sep 17 00:00:00 2001 From: jesus Date: Sat, 28 Jan 2006 20:39:36 +0000 Subject: [PATCH] implemented keep focused cell visible while scrollbar scrolling git-svn-id: trunk@8647 - --- lcl/grids.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lcl/grids.pas b/lcl/grids.pas index 2a7c7c9190..a17b51dbb8 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -96,7 +96,8 @@ type goRelaxedRowSelect, // User can see focused cell on goRowSelect goDblClickAutoSize, // dblclicking columns borders (on hdrs) resize col. goSmoothScroll, // Switch scrolling mode (pixel scroll is by default) - goFixedRowNumbering // Ya + goFixedRowNumbering, // Ya + goScrollKeepVisible // keeps focused cell visible while scrolling ); TGridOptions = set of TGridOption; @@ -3084,12 +3085,17 @@ end; procedure TCustomGrid.TryScrollTo(aCol, aRow: Integer); var TryTL: TPoint; + NewCol,NewRow: Integer; begin TryTL:=ScrollGrid(False,aCol, aRow); if not PointIgual(TryTL, FTopLeft) then begin + NewCol := TryTL.X - FTopLeft.X + Col; + NewRow := TryTL.Y - FTopLeft.Y + Row; FTopLeft:=TryTL; //DebugLn('TCustomGrid.TryScrollTo A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft)); doTopleftChange(False); + if goScrollKeepVisible in Options then + MoveNextSelectable(False, NewCol, NewRow); end; end;