MouseWheel Scrolling doesn't trigger OnScroll

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
skassan
Newbie
Newbie
Posts: 27
Joined: Fri Sep 18, 2009 12:00 am

MouseWheel Scrolling doesn't trigger OnScroll

Post by skassan » Fri Oct 09, 2009 8:42 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: MouseWheel Scrolling doesn't trigger OnScroll

Post by Narcís » Tue Oct 13, 2009 11:37 am

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;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

konzeptum_sd
Newbie
Newbie
Posts: 4
Joined: Mon Jan 14, 2019 12:00 am
Location: Koblenz, Germany
Contact:

Re: MouseWheel Scrolling doesn't trigger OnScroll

Post by konzeptum_sd » Tue Mar 05, 2024 5:49 pm

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

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: MouseWheel Scrolling doesn't trigger OnScroll

Post by Yeray » Thu Mar 07, 2024 12:31 pm

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

konzeptum_sd
Newbie
Newbie
Posts: 4
Joined: Mon Jan 14, 2019 12:00 am
Location: Koblenz, Germany
Contact:

Re: MouseWheel Scrolling doesn't trigger OnScroll

Post by konzeptum_sd » Thu Mar 07, 2024 1:49 pm

Hi,

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

All the best,
Stefan

Post Reply