Page 1 of 1

TMarksTipTool: OnHint index?

Posted: Tue Jul 13, 2010 3:53 pm
by 10546565
With a TMarksTipTool.OnGetText, there is no .Index property that I can find to know what help should be pointing at.

Any suggestions on how to find this?

Ed Dressel

Re: TMarksTipTool: OnHint index?

Posted: Wed Jul 14, 2010 7:45 am
by yeray
Hi Ed,

You could set the MarkTips Style to be smsPointIndex and use it at ChartTool1GetText:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  ChartTool1.Style:=smsPointIndex;
end;

procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool; var Text: String);
var ValueIndex: Integer;
begin
  ValueIndex:=StrToInt(Text);
  Text:='X: ' + FloatToStr(Sender.Series.XValue[ValueIndex]) + #13 + 'Y: ' + FloatToStr(Sender.Series.YValue[ValueIndex]);
end;

Re: TMarksTipTool: OnHint index?

Posted: Wed Nov 03, 2010 10:05 pm
by 10548769
Hi, i found that topic and i must say that you need to change the event because when you use that tool on All Series, the Sender.Series = Nil
So, it should be a good idea to make it nice and add the Index and Series that as been "clicked / moved on" for the hint.

Re: TMarksTipTool: OnHint index?

Posted: Thu Nov 04, 2010 8:33 am
by narcis
Hi GotoXY,
Hi, i found that topic and i must say that you need to change the event because when you use that tool on All Series, the Sender.Series = Nil
A safeguard could be implementing the event like this:

Code: Select all

procedure TForm1.ChartTool1GetText(Sender: TMarksTipTool;
  var Text: String);
begin
  if Assigned(Sender.Series) then
  begin
    ValueIndex:=StrToInt(Text);
    Text:='X: ' + FloatToStr(Sender.Series.XValue[ValueIndex]) + #13 + 'Y: ' + FloatToStr(Sender.Series.YValue[ValueIndex]);
  end;
end;
So, it should be a good idea to make it nice and add the Index and Series that as been "clicked / moved on" for the hint.
It can be easily found using TeeChart's mouse events combined with series' Clicked method. Anyway, I have added your request to the wish-list (TV52015263) to be considered for inclusion in future releases.