Folks,
For some reason my left click event in a Legend check box is no longer working. The right click and middle click works fine and triggers an OnClickLegend event successfully. I'm very confused as it was working previously. My legend position is drawn at a CustomPosition=true. I may be doing something stupid but please help.
Regards,
D'Arcy.
Legend Checkbox left click not working, right click ok
Re: Legend Checkbox left click not working, right click ok
Hi D'Arcy,
I'm not able to reproduce it here with the following code:
Could you please modify it so we can reproduce it here (or send us a simple example project we can run as-is to reproduce the problem here)?
I'm not able to reproduce it here with the following code:
Code: Select all
procedure TForm1.Chart1ClickLegend(Sender: TCustomChart; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ShowMessage('legend clicked!');
end;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
for i := 0 to 9 do
begin
Chart1.AddSeries(TLineSeries.Create(self));
Chart1[i].FillSampleValues();
end;
Chart1.Legend.CheckBoxes:=true;
Chart1.Legend.CustomPosition:=true;
Chart1.Legend.Left:=100;
Chart1.Legend.Top:=50;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Legend Checkbox left click not working, right click ok
Hi Yeray,
Problem sorted. Thanks for the example. When I created a clean example the legend click worked fine (left, middle, right click). Therefore it was local to my application. One for your records, when the TDrawLineTool is added it can take control of the left click. Guess it was due to the left click and drag functionality being enabled by default within the tool which took precedence of the left click event. Only when I removed this did it re-enable the left click for the legend.
Thanks for the help.
Regards,
D'Arcy
Problem sorted. Thanks for the example. When I created a clean example the legend click worked fine (left, middle, right click). Therefore it was local to my application. One for your records, when the TDrawLineTool is added it can take control of the left click. Guess it was due to the left click and drag functionality being enabled by default within the tool which took precedence of the left click event. Only when I removed this did it re-enable the left click for the legend.
Thanks for the help.
Regards,
D'Arcy
Re: Legend Checkbox left click not working, right click ok
Hello darcy,
I found a simple solution that I think solve your problem. Please check next code works correctly.
I hope will help.
Thanks,
I found a simple solution that I think solve your problem. Please check next code works correctly.
Code: Select all
var ChartTool1: TDrawLineTool;
procedure TForm1.Chart1ClickLegend(Sender: TCustomChart; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ShowMessage('legend clicked!');
end;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
ChartTool1 := TDrawLineTool.Create(Self);
Chart1.Tools.Add(ChartTool1) ;
for i := 0 to 9 do
begin
Chart1.AddSeries(TLineSeries.Create(self));
Chart1[i].FillSampleValues();
end;
Chart1.Legend.CheckBoxes:=true;
Chart1.Legend.CustomPosition:=true;
Chart1.Legend.Left:=100;
Chart1.Legend.Top:=50;
end;
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ChartTool1.EnableDraw:=not PtInRect(Chart1.Legend.RectLegend,Point(X,Y));
end;
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |