TeeUseMouseWheel and OnAllowScroll problem
Posted: 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.
Steema Software - Customer Support Forums
http://216.92.101.67/support/
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;
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;
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;
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.narcis wrote: Ok, as Pep said, this is already listed on our wish-list to be implemented for next releases.
Thanks for the advise. Yes, it's on our wish list too.By the way, scrolling with mouse seems ignores AllowPanning value