Page 1 of 1

Set OnZoom in Runtime

Posted: Fri Aug 29, 2008 12:32 pm
by 10547029
Hi!

How can I set (change) Chart.OnZoom in runtime?

Posted: Fri Aug 29, 2008 12:48 pm
by narcis
Hi msd48,

Sorry but I don't understand which is your exact request. Are you trying to fire the OnZoom event? Would you like to zoom the chart at runtime? ...

Would you be so kind to give us some more details about what you are trying to achieve?

Thanks in advance.

Posted: Fri Aug 29, 2008 12:53 pm
by 10547029
Ok.

I`ve something like this:

Code: Select all

procedure TFormMain.ChartZoom(Sender: TObject);
begin
  zoomOff;
end;

How can I change in runtime change event handler from zoomOff to zoomOff2 ?

zoomOff and zoomOff2 - it`s a procedures.

Posted: Fri Aug 29, 2008 1:08 pm
by narcis
Hi msd48,

I can think of 2 options:

a. Use an if clause in the OnZoom event implementation:
procedure TForm1.Chart1Zoom(Sender: TObject);
begin
if condition then
zoomOff
else
zoomOff2
end;
b. Use 2 OnZoom event implementations:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.OnZoom:=Chart1Zoom;
  //Your code here
  Chart1.OnZoom:=Chart1Zoom2;
end;

procedure TForm1.Chart1Zoom(Sender: TObject);
begin
  zoomOff;
end;

procedure TForm1.Chart1Zoom2(Sender: TObject);
begin
  zoomOff2;
end;
Hope this helps!

Posted: Fri Aug 29, 2008 1:24 pm
by 10547029
Hi, NarcĂ­s

Second option - the very it!

Thanks for help.
The question is closed.