A vertical Cursor Tool's OnSnapChange event does not fire if the cursor tool's X value has been changed programmatically and the next mouse movement is then back to the XValue the cursor tool was at before its XValue was changed.
Fill a line series with 10 values (FillSampleValues) so its X axis goes from 0 to 9.
Add a CursorTool with Snap true and FollowMouse true.
In the CursorTool's OnSnapChange event, display GetTickCount on a label so this event's firing can be detected.
Move the mouse to position the cursor at X=8 and move the mouse off the chart.
Click a button configured to set the cursortool's XValue = 1
The cursor will move to X=1
Now move the mouse back onto the chart at location X = 8. The cursor moves from X=1 to X=8 but the OnSnapChange event does not fire.
It seems as though manual changes to the cursortool's XValue are not passed onto whatever parameter the OnSnapChange method is comparing to. Any way to get this to happen ?
Cursor Tool Snap Change misses manual changes to XValue
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Steve,
It works fine here following your instructions, using latest TeeChart sources and this code:
If you want I can send you the complete application for you to test it.
It works fine here following your instructions, using latest TeeChart sources and this code:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues(10);
GetTickCount:=0;
end;
procedure TForm1.ChartTool1SnapChange(Sender: TCursorTool; x, y: Integer;
const XValue, YValue: Double; Series: TChartSeries; ValueIndex: Integer);
begin
inc(GetTickCount);
Chart1.Title.Text[0]:=IntToStr(GetTickCount);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ChartTool1.XValue:=1;
end;
Best Regards,
Narcís Calvet / 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 |
Narcis,
Are you moving the mouse on the chart to X=8 so the cursor gets positioned there, then moving the mouse vertically off the chart so the cursor remains at X=8. Then click the buton to programmatically change the XValue=1. Then move the mouse (still off the chart) so it is aligned above or below the chart at the chart's X=8 position. Then move the mouse to re-enter the chart at X=8 ? When I re-enter at X=8, the OnSnapChange event does not fire. If I re-enter at another X value, it does fire. TChart 7.04
Steve
Are you moving the mouse on the chart to X=8 so the cursor gets positioned there, then moving the mouse vertically off the chart so the cursor remains at X=8. Then click the buton to programmatically change the XValue=1. Then move the mouse (still off the chart) so it is aligned above or below the chart at the chart's X=8 position. Then move the mouse to re-enter the chart at X=8 ? When I re-enter at X=8, the OnSnapChange event does not fire. If I re-enter at another X value, it does fire. TChart 7.04
Steve
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Steve,
I've been able to reproduce this problem here and has already been fixed to be included at the next maintenance release.
I've been able to reproduce this problem here and has already been fixed to be included at the next maintenance release.
Best Regards,
Narcís Calvet / 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 |