implemented keep focused cell visible while scrollbar scrolling

git-svn-id: trunk@8647 -
This commit is contained in:
jesus 2006-01-28 20:39:36 +00:00
parent 55749b3025
commit 4ce49481be

View File

@ -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;