diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2014-08-22 01:14:05 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2014-08-22 01:14:05 +0100 |
commit | ab9787fbf42c41200a3060035a823c82c79ef68b (patch) | |
tree | e0080fddbe3c7829ea0159894b7a3899766bd8e7 /src | |
parent | adf4fa9961122333a7699972213a7d37967079f8 (diff) | |
download | fpGUI-ab9787fbf42c41200a3060035a823c82c79ef68b.tar.xz |
Fixes bug #162 (Home/End doesn't move cell focus is smoothscroll StringGrid)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/fpg_basegrid.pas | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/fpg_basegrid.pas b/src/gui/fpg_basegrid.pas index cbce739f..be23f8c8 100644 --- a/src/gui/fpg_basegrid.pas +++ b/src/gui/fpg_basegrid.pas @@ -1504,6 +1504,7 @@ procedure TfpgBaseGrid.FollowFocus; var n: Integer; w: TfpgCoord; + lmin, lmax: TfpgCoord; begin if (RowCount > 0) and (FFocusRow < 0) then FFocusRow := 0; @@ -1546,6 +1547,19 @@ begin end; end; { for } end; { if/else } + + // If smoothscroll, convert FFirstCol to X Offset value + if go_SmoothScroll in FOptions then + begin + w := 0; + for n := 0 to FFocusCol-1 do + w := w + ColumnWidth[n]; + lmin := FXOffset; + lmax := FXOffset + VisibleWidth; + if (w > lmax) or (w < lmin) then + FXOffset := w; + end; + CheckFocusChange; UpdateScrollBars; end; |