07-07-2009 01:49 PM
Solved! Go to Solution.
07-09-2009 05:14 PM
Hi rmich,
Could you please explain what kind of offset and scaling you're experiencing? The Help for the GetGraphCoordsFromPoint function state that "The pixel coordinates should be relative to the top, left corner of the panel. The return value indicates whether the point is within the graph plot area."
How does what you're experiencing differ from this?
07-13-2009 10:05 AM
I created a simple app with a 100x100 graph and a callback to print the coordinates.
...
case EVENT_LEFT_CLICK:
GetRelativeMouseState (panel, control, &mx, &my, NULL, NULL, NULL);
status = GetGraphCoordsFromPoint (panel, control, MakePoint(mx, my), &x, &y);
if(status>0)
printf("%d,%d = %lf, %lf\n", mx, my, x, y);
break;
...
This is an example of what I get when I click on the graph:
Where I Click Reported coodinates
0, 20 4.3,28.9
30,70 4.3, 97.3
100,0 84.0, 26.8
100,75 84.0, 97.8
status is <0 for any Xless tha ~20 or Y greater than ~75. It will report valid coordinates by clicking below or to the right of the plot area down to the lower right of the graph control. It is as if the reported area is shifted to the right and down.
07-13-2009 11:42 AM
Try calling GetRelativeMouseState() with 0 instead of a control value.
JR
07-13-2009 12:34 PM