summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-09-12 00:51:01 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-09-12 00:51:01 +0200
commit57ec7dcca6de86a7b88a12fb4fcd7639445ed0f6 (patch)
tree60d49734be2f0363687acad70f378c51437525b5 /src
parentcda56fc88208ee0f7838d0e3679e5ac959ad923f (diff)
downloadfpGUI-57ec7dcca6de86a7b88a12fb4fcd7639445ed0f6.tar.xz
treeview: Mouse wheel scroll, now scrolls 1/3 of height, and not 1 pixel
Diffstat (limited to 'src')
-rw-r--r--src/gui/fpg_tree.pas14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/fpg_tree.pas b/src/gui/fpg_tree.pas
index 30305b04..e3bc5646 100644
--- a/src/gui/fpg_tree.pas
+++ b/src/gui/fpg_tree.pas
@@ -1807,23 +1807,25 @@ procedure TfpgTreeview.HandleMouseScroll(x, y: integer;
shiftstate: TShiftState; delta: smallint);
var
i: integer;
+ dy: integer;
begin
inherited HandleMouseScroll(x, y, shiftstate, delta);
- if delta > 0 then
+ dy := (VisibleHeight div 3); // mouse scrolling is 1/3 of the height
+ if delta > 0 then // scrolling down
begin
- inc(FYOffset, FScrollWheelDelta);
+ inc(FYOffset, dy); //FScrollWheelDelta);
i := (GetNodeHeightSum * GetNodeHeight) - VisibleHeight + FHScrollbar.Height;
if FYOffset > i then
FYOffset := i;
- i := FVScrollbar.Position + FScrollWheelDelta;
+ i := FVScrollbar.Position + dy;
FVScrollbar.Position := i;
end
else
- begin
- dec(FYOffset, FScrollWheelDelta);
+ begin // scrolling up
+ dec(FYOffset, dy); //FScrollWheelDelta);
if FYOffset < 0 then
FYOffset := 0;
- i := FVScrollbar.Position - FScrollWheelDelta;
+ i := FVScrollbar.Position - dy;
FVScrollbar.Position := i;
end;
UpdateScrollbars;