Page 1 of 1

Missing events in TColorLineTool

Posted: Mon Jul 11, 2011 9:20 pm
by 10546756
Hello!

I'm missing the events OnMouseEnter and OnMouseLeave for the TColorLineTool.

When I right click on a TColorLineTool I want my popupmenu to activate the feature "Delete ColourLine".
Is there some other way to do this without the above events?

Regards, Mikael

Re: Missing events in TColorLineTool

Posted: Tue Jul 12, 2011 10:37 am
by yeray
Hello,

You could use Chart's OnMouseDown event in combination with the tool Clicked function to check if the TColorLine has been clicked. For example:

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var i: Integer;
begin
  for i:=0 to Chart1.Tools.Count-1 do
    if (Chart1.Tools[i] is TColorLineTool) then
      if (Chart1.Tools[i] as TColorLineTool).Clicked(X,Y) then
      begin
        Chart1.Tools.Remove(Chart1.Tools[i]);
        Chart1.Repaint;
      end;
end;