Page 1 of 1

MouseWheel Scrolling doesn't trigger OnScroll

Posted: Fri Oct 09, 2009 8:42 pm
by 10054271
The subject says it all. The same is probably true if the AxisScroll or AxisArrows tools are used. All three behave differently than manually panning with the right mouse button. After panning around with the right mouse button, UndoZoom restores the chart to it's "original" axis values. Using the MouseWheel to scroll does not. Neither do the AxisScroll or AxisArrow tools in the Demo program.

Re: MouseWheel Scrolling doesn't trigger OnScroll

Posted: Tue Oct 13, 2009 11:37 am
by narcis
Hi skassan,

Yes, I could reproduce this here. I'll add your request to the wish-list to be considered for inclusion in future releases. In the meantime you can reset scroll implementing the OnUndoZoom event like this:

Code: Select all

procedure TForm4.Chart1UndoZoom(Sender: TObject);
begin
  Chart1.Axes.Left.Automatic:=true;
  Chart1.Axes.Bottom.Automatic:=true;
end;

Re: MouseWheel Scrolling doesn't trigger OnScroll

Posted: Tue Mar 05, 2024 5:49 pm
by 16485376
Hi,

I'd like to bump this old request, based on a different use case.

We use the OnScroll event to synchronize the (horizontal, i.e. date) position of our Gantt chart with a corresponding workload chart we display below it. When panning via mouse button this works by simply setting

Code: Select all

dbChartLoad.BottomAxis.SetMinMax(dbChartGantt.TopAxis.Minimum,
                                 dbChartGantt.TopAxis.Maximum);
or vice versa in the OnScroll event handler.
Since one of our recent updates (probably the Bug #2433 fix for horizontal-only mouse wheel scrolling), the charts now react to the mouse wheel - which is good - but they don't sync.

Our somewhat dirty workaround is propagating the actual scrolling by calling the other chart's corresponding protected function from the mouse wheel event handler:

Code: Select all

type
  TkoDBChartAccessor = class(TDBChart);
  
var
  fSyncMouseWheelTarget : TDBChart;

procedure TSomeFrame.dbChartGanttOrLoadMouseWheel(Sender: TObject;
                       Shift: TShiftState; WheelDelta: Integer;
                       MousePos: TPoint; var Handled: Boolean);
begin
  if Sender = fSyncMouseWheelTarget then
    begin
      //end recursion: don't propagate any further, but don't prevent the
      //scrolling either
      exit;
    end;
  if Sender = dbChartGantt then
    begin
      fSyncMouseWheelTarget := dbChartLoad;
    end
  else //Sender = dbChartLoad 
    begin
      fSyncMouseWheelTarget := dbChartGantt;
    end;
  try
    TkoDBChartAccessor(fSyncMouseWheelTarget).DoMouseWheel(Shift, WheelDelta,
                                                           MousePos);
  finally
    fSyncMouseWheelTarget := nil;
  end;
end;
I also tried adding a TChartScrollBar but it did not trigger the OnScroll event either. Since I ran into some other trouble with it also, we postponed that. In any case, supporting the OnScroll-Event no matter the scrolling method would provide for a straightforward and clean solution.

Our current build version is 2023.37.230130.

Thanks in advance for checking again,
Stefan

Re: MouseWheel Scrolling doesn't trigger OnScroll

Posted: Thu Mar 07, 2024 12:31 pm
by yeray
Hello Stefan,

I'm afraid the request NarcĂ­s added was lost when we moved to bugzilla.
I've added it at #2683, and already fixed it.

So the next version should be triggering OnScroll event from the mouse wheel.

Re: MouseWheel Scrolling doesn't trigger OnScroll

Posted: Thu Mar 07, 2024 1:49 pm
by 16485376
Hi,

ok, that. was. fast. Many thanks! :)

All the best,
Stefan