Strange scrolling behaviour using mouse wheel
Posted: Thu Jul 24, 2014 6:11 am
In the TTree component of TeeChart 2014 of May, 12, 2014, one can observe a strange scrolling behviour using the mouse wheel.
At first, the tree is scrolled beyond the top and the bottom if the top or bottom of the tree is reached.
Second, the zooming direction is inverted in contrast to the TTree component of TeeChart 2012.
Therefore, I changed TeeTree.pas, function TCustomTree.InternalWheel, in the following way:
At first, the tree is scrolled beyond the top and the bottom if the top or bottom of the tree is reached.
Second, the zooming direction is inverted in contrast to the TTree component of TeeChart 2012.
Therefore, I changed TeeTree.pas, function TCustomTree.InternalWheel, in the following way:
Code: Select all
procedure TCustomTree.InternalWheel(IsDown:Boolean);
var tmp : Double;
tmpFactor : Integer;
begin
if IsDown then
tmpFactor:=+1
else
tmpFactor:=-1;
case FWheelNavigation of
wnSelection : if IsDown then
ProcessKey(TeeTree_DownKey,[]) // navigate one node down
else
ProcessKey(TeeTree_UpKey,[]); // navigate one node up
wnScrollVert : with View3DOptions do
// VertOffset:=VertOffset+tmpFactor*TreePageScrollQuantity;
// Avoid scrolling beyond top and bottom
if VertScrollBar.Visible then
begin
if IsDown then
VertOffset:=Max(VertOffset-tmpFactor*TreePageScrollQuantity, -(VertScrollBar.Max - VertScrollBar.PageSize + 1))
else
VertOffset:=Min(VertOffset-tmpFactor*TreePageScrollQuantity, 0);
end;
wnScrollHoriz : with View3DOptions do
HorizOffset:=HorizOffset+tmpFactor*2;
wnZoom : with View3DOptions do
begin
tmp:=Math.Max(1,0.05*ZoomFloat);
// Ensure zooming behaviour of TeeChart 2012:
// to top downsize, to bottom enlarge
// ZoomFloat:=Max(1,ZoomFloat-tmpFactor*tmp);
ZoomFloat:=Max(1,ZoomFloat+tmpFactor*tmp);
end;
end;
end;