TeeUseMouseWheel and OnAllowScroll problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

TeeUseMouseWheel and OnAllowScroll problem

Post by xxxxxx » Fri Jul 27, 2007 12:44 pm

The problem is that scrolling with MouseWheell doesn't fire OnAllowScroll event thus preventing me from control of moving all series outside ChartRect.
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jul 27, 2007 4:04 pm

Hi Alexander,

yes, since we add this checking on our sources (which is on our wish list) it will have to be done manually.
You could use the OnAfterDraw event to do it, using similar code to the following one :

Code: Select all

procedure TForm1.Chart1AllowScroll(Sender: TChartAxis; var AMin,
  AMax: Double; var AllowScroll: Boolean);
begin
 // your code here...
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var axisleftmin,axisleftmax : double;
    scroll : boolean;
begin
  axisleftmin := Chart1.axes.left.minimum;
  axisleftmax := Chart1.axes.left.maximum;
  scroll := true;

if TeeUseMouseWheel=true then
  Chart1AllowScroll(chart1.Axes.Left,axisleftmin,axisleftmax,scroll);
end;

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Fri Jul 27, 2007 5:07 pm

Seems you meant in a such way?

Code: Select all

if TeeUseMouseWheel=true then 
begin
  Chart1AllowScroll(chart1.Axes.Left,axisleftmin,axisleftmax,scroll); 
  if scroll then
    chart1.Axes.Left.SetMinMax(axisleftmin,axisleftmax)
  else
    ???  
end; 
Unfortunately, at the point, marked with questions, previous minimum and maximum of an axis are already lost and refusing scroll is not possible:cry:
Have a good weekend!
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Jul 30, 2007 4:26 pm

Hi Alexander,

hmmm... how about ?

Code: Select all

  private
    min, max : double;

procedure TForm1.Chart1AllowScroll(Sender: TChartAxis; var AMin,
  AMax: Double; var AllowScroll: Boolean);
begin
  if (Chart1.AllowPanning = pmVertical) or (Chart1.AllowPanning = pmBoth) then
    if (Amin<=min) or (Amax >= Max) then
        AllowScroll := false;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var axisleftmin,axisleftmax : double;
    axisleftmin2,axisleftmax2 : double;
    scroll : boolean;
begin
if assigned(Series1) then
begin
  if min = -1 then
   min := Chart1.Axes.Left.Minimum;

  if max = -1 then
    max := Chart1.Axes.Left.Maximum;

  if TeeUseMouseWheel=true then
  begin
    axisleftmin := Chart1.axes.left.minimum;
    axisleftmax := Chart1.axes.left.maximum;
    Chart1AllowScroll(chart1.Axes.Left,axisleftmin,axisleftmax,scroll);
    if scroll then
    begin
      min := axisleftmin;
      max := axisleftmax;
    end
    else begin
     Chart1.Axes.Left.SetMinMax(min,max);
    end;
  end;
end;
end;

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Mon Jul 30, 2007 6:43 pm

Thank you, Pep for this suggestion!
By this moment I undertook more radical workaround - completely intercepted default TeeChart scroll behavior in OnMouseWheel event.
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Wed Aug 01, 2007 1:08 pm

By the way, scrolling with mouse seems ignores AllowPanning value :(

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

Post by Narcís » Wed Aug 01, 2007 2:03 pm

Hi Alexander,

What about using TabStop property as suggested on this thread?

Thanks in advance.
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

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Wed Aug 01, 2007 2:12 pm

Hi, Narchs!
It's not a problem for me to enable scroll, the issue is how to handle it in a uniform way with trapping OnAllowScroll event and in accordance with AllowPanning value.
For better understanding let me bring up just an example - for some reasons I prevent a user from dragging series with Right Mouse by AllowPanning=pmHorizontal, however it (politely to say - he or she) is still able to shift series in vertical using MouseWheel.
For my projects I have already found a workaround, but in general I suggest this behavior must be changed.
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009

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

Post by Narcís » Wed Aug 01, 2007 2:45 pm

Hi Alexander,

Ok, as Pep said, this is already listed on our wish-list to be implemented for next releases.
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

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Wed Aug 01, 2007 3:02 pm

narcis wrote: Ok, as Pep said, this is already listed on our wish-list to be implemented for next releases.
That's true, but because we discussed with him OnAllowScroll event I just added to the discussion AllowPanning issue. If it's also included into your wish list I'm almost (until next release:) satisfied.

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Aug 07, 2007 11:59 am

Hi Alexander,
By the way, scrolling with mouse seems ignores AllowPanning value
Thanks for the advise. Yes, it's on our wish list too.

Post Reply