Is there a OnMarkClick() event?

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Is there a OnMarkClick() event?

Post by elmec » Wed Jun 11, 2014 1:50 am

I am using TPointSeries with setting the Marks visible.
And I want to do sth. when Marks clicked,
is there some event like OnMarkClick()?

Thanks in advance.

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

Re: Is there a OnMarkClick() event?

Post by Yeray » Wed Jun 11, 2014 9:38 am

Hello,

There's a clicked function for the Marks, so you could use the Chart's OnMouseDown event as follows:

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Single);
begin
  Caption:=IntToStr(Chart1[0].Marks.Clicked(Round(X), Round(Y)));
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

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Is there a OnMarkClick() event?

Post by elmec » Sun Jun 15, 2014 2:38 am

Thank you.
And one more question about TAxisArrowTool.
I want to know if TChart or TAxisArrowTool is doubleclicked.

And the events were triggled as below when the TAxisArrowTool doubleclicked.
So I set a flag for TAxisArrowToolClick (1), then check the flag when Chart1DblClick (2) triggled,and clear the flag.
But the flag is set again by (3).. so if I doubleclicked the TChart after (3), it result in that TAxisArrowTool was doubleclicked..
Is there any better idea?

Code: Select all

TAxisArrowToolClick      (1)
Chart1DblClick              (2)
TAxisArrowToolClick      (3)
Thanks in advance.

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

Re: Is there a OnMarkClick() event?

Post by Yeray » Mon Jun 16, 2014 11:18 am

Hello,
elmec wrote:And one more question about TAxisArrowTool.
I want to know if TChart or TAxisArrowTool is doubleclicked.
I've done a simple tests, and adding a boolean variable as follows I seem to be able to check when the arrow has been doubleclicked:

Code: Select all

var dbClick: bool=false;

procedure TForm1.Chart1Click(Sender: TObject);
begin
  dbClick:=false;
  Memo1.Lines.Add('Chart Click');
end;

procedure TForm1.Chart1DblClick(Sender: TObject);
begin
  dbClick:=true;
  Memo1.Lines.Add('Chart DblClick');
end;

procedure TForm1.ChartTool1Click(Sender: TAxisArrowTool; AtStart: Boolean);
begin
  if dbClick then
  begin
    Memo1.Lines.Add('Arrow DblClick');
    dbClick:=false;
  end
  else
    Memo1.Lines.Add('Arrow Click');
end;
This sounds as a completely different question. Please, try to create different threads for different questions as indicated in the instructions in my signature.
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

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Is there a OnMarkClick() event?

Post by elmec » Tue Jun 17, 2014 2:29 am

Thank you.

But I also want to do sth.
when just doubleclicking the TChart, not the TAxisArrowTool,
so I want to know which is doubleclicked when TChartDblClicked event triggled.

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: Is there a OnMarkClick() event?

Post by elmec » Tue Jun 17, 2014 2:32 am

In a word, I want to do sth. as below in Chart1DblClick function.

Code: Select all

void __fastcall TForm12::Chart1DblClick(TObject *Sender)
{
	if (AxisArrowClicked)
		do sth.
	else
		do sth.
}

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

Re: Is there a OnMarkClick() event?

Post by Yeray » Tue Jun 17, 2014 1:04 pm

Hello,

You can play further with the events to find what you are looking for.
If I understand you correctly, this would achieve it:

Code: Select all

var chartClicked: bool=false;
    chartDblClicked: bool=false;
    arrowClicked: bool=false;
    arrowDblClicked: bool=false;
    myMouseDown: TPoint;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Pages.MaxPointsPerPage:=5;
end;

procedure TForm1.Chart1Click(Sender: TObject);
begin
  chartDblClicked:=false;
  arrowDblClicked:=false;
  chartClicked:=true;
end;

procedure TForm1.Chart1DblClick(Sender: TObject);
begin
  chartDblClicked:=true;
end;

procedure TForm1.ChartTool1Click(Sender: TAxisArrowTool; AtStart: Boolean);
begin
  if chartDblClicked then
  begin
    arrowDblClicked:=true;
    chartDblClicked:=false;
  end
  else
  begin
    arrowClicked:=true;
    chartClicked:=false;
  end;
end;

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  myMouseDown.X:=X;
  myMouseDown.Y:=Y;
end;

procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if chartClicked then
    Memo1.Lines.Add('Chart Clicked');
  if arrowClicked then
    Memo1.Lines.Add('Arrow Clicked');
  if chartDblClicked then
    Memo1.Lines.Add('Chart Double Clicked');
  if arrowDblClicked then
    Memo1.Lines.Add('Arrow Double Clicked');

  chartClicked:=false;
  arrowClicked:=false;
  chartDblClicked:=false;
  arrowDblClicked:=false;
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

Post Reply