diff options
author | Jean-Marc.Levecque <jmarc.levecque@bbox.fr> | 2014-12-06 15:46:47 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2014-12-06 15:46:47 +0000 |
commit | 01bfc8fe202d026f3365de2ac5a2f086c96cf53c (patch) | |
tree | 07baabef0ad8461ed850c3a0c641644ad082b331 /src | |
parent | 78d25c5f23eb6ce2bfe146e78c6a0fc9f89e400d (diff) | |
download | fpGUI-01bfc8fe202d026f3365de2ac5a2f086c96cf53c.tar.xz |
Improve horizontal srcollbar behaviour
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/fpg_basegrid.pas | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/gui/fpg_basegrid.pas b/src/gui/fpg_basegrid.pas index 8c29ed5e..560a7a46 100644 --- a/src/gui/fpg_basegrid.pas +++ b/src/gui/fpg_basegrid.pas @@ -736,6 +736,20 @@ var Vfits := vl >= RowCount; end; + function ColMax: integer; + var + i : integer; + begin + i := 0; + result := ColumnCount; + while i < HWidth do + begin + dec(result); + i := i + ColumnWidth[result]; + end; + inc(result); + end; + begin // if we don't want any scrollbars, hide them and exit if FScrollBarStyle = ssNone then @@ -848,16 +862,15 @@ begin if FXOffset>hmax then FXOffset:=hmax; FHScrollBar.Position := FXOffset; - FHScrollBar.SliderSize := HWidth / TotalColumnWidth; FHScrollBar.PageSize := 5; end else begin - FHScrollBar.Max := ColumnCount-1; + FHScrollBar.Max := ColMax; FHScrollBar.Position := FFirstCol; - FHScrollBar.SliderSize := 1 / ColumnCount; FHScrollBar.PageSize := 1; end; + FHScrollBar.SliderSize := HWidth / TotalColumnWidth; FHScrollBar.RepaintSlider; FHScrollBar.Top := Height - FHScrollBar.Height - borders.Bottom; FHScrollBar.Left := borders.Left; |