Dear reader,
I am developing a statistical application that performs clustering. Based on user input the program calculates a number of clusters and graphs the results. The charts are dynamically created at runtime and the number of graphs is not known in advance (varies from 2 - 50). The program works quite nicely but the charts lack support for user interaction. I want to be able to click on any of the charts and assign that chart to the TeeCommander for saving or editing. How can I identify/capture which of the charts triggered an OnClick event? Thank you for your support.
Identify which chart send OnClick event
Re: Identify which chart send OnClick event
Hello,
The TChart's OnClick event gives you the TChart that "sent" the event. So you can assign that Sender to the TTeeCommander's Panel property. Ie:
The TChart's OnClick event gives you the TChart that "sent" the event. So you can assign that Sender to the TTeeCommander's Panel property. Ie:
Code: Select all
uses Chart;
var Charts: array of TChart;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Setlength(Charts, 3);
for i:=0 to High(Charts) do
begin
Charts[i]:=TChart.Create(Self);
Charts[i].Parent:=Self;
Charts[i].Align:=alTop;
Charts[i].OnClick:=ChartOnClick;
end;
end;
procedure TForm1.ChartOnClick(Sender: TObject);
begin
TeeCommander1.Panel:=Sender as TChart;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Identify which chart send OnClick event
This works great! Thank you Yeray!