Use EVENT_COMMIT instead of EVENT_LEFT_CLICK and your problems are gone !
EVENT_LEFT_CLICK is called before the actual movement of the cursor, hence
you get the old coordinates.
When EVENT_COMMIT is called, you can be sure that the user-action is
finished !
Regards,
Manfred
Geert Van Doorselaer schrieb in im
Newsbeitrag: 3b82668e@newsgroups....
> I need to obtain the coordinates of a point somewhere in a graph, when I
> click on this point.
> I try this using this function:
>
> int CVICALLBACK Curve_Click (int panel, int control, int event,
> void *callbackData, int eventData1, int eventData2)
> {
> switch (event)
> {
> case EVENT_LEFT_CLICK:
> GetGraphCursor (panelHandlePlot, PANEL_PLOT_GRAPH, 1, &x_cursor,
> &y_cursor);
> break;
> }
> return 0;
> }
>
> where x_cursor and y_cursor are defined globally.
> However, the cursor does not jump to the place where I click. Also, I do
not
> obtain the coordinates of the place where I click, but the coordinates of
> the place where I clicked previously.
>
>
> A way to avoid this is adding an extra command button, which calls the
> functions:
>
> GetGraphCursor (panelHandlePlot, PANEL_PLOT_GRAPH, 1, &x_cursor,
&y_cursor);
> SetGraphCursor (panelHandlePlot, PANEL_PLOT_GRAPH, 1, x_cursor, y_cursor);
>
> The user then has to click first somewhere in the graph, then click on the
> command button. Only then the cursor jumps to the place where the user has
> just clicked. This is quite confusing and non-intuitive for the user.
> Is there a better way to do this?
>
> Kind regards,
> Geert Van Doorselaer
>
>