PageNumTool and event

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Calou
Advanced
Posts: 104
Joined: Wed Nov 19, 2008 12:00 am

PageNumTool and event

Post by Calou » Mon Jan 24, 2011 5:09 pm

Hello,

I am looking for an event on the TPageNumTool in order to change the chart title when the number of page change.
I have tested with the event on click but it is not fired when the page change only when we click on the tool

Thanks for help

Regards

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

Re: PageNumTool and event

Post by Yeray » Tue Jan 25, 2011 9:38 am

Hi Calou,

There is not a public event for the tool but there is an event for the chart pages, the OnPageChange event. You can use assign it at design time or at runtime as follows:

Code: Select all

procedure Chart1PageChange(Sender: TObject);
//...
uses Series, TeePageNumTool;

procedure TForm1.FormCreate(Sender: TObject);
begin
  with Chart1.AddSeries(TBarSeries) do FillSampleValues(25);

  Chart1.Tools.Add(TPageNumTool);

  Chart1.Pages.MaxPointsPerPage:=5;

  Chart1.OnPageChange:=Chart1PageChange;
end;

procedure TForm1.Chart1PageChange(Sender: TObject);
begin
  Chart1.Title.Text.Text:=IntToStr(Chart1.Pages.Current);
end;
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

Calou
Advanced
Posts: 104
Joined: Wed Nov 19, 2008 12:00 am

Re: PageNumTool and event

Post by Calou » Tue Jan 25, 2011 11:39 am

Thanks

Post Reply