From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in eventData1 parameters in graph callbeck raised by cursor

According to documentation, eventData1 parameter in graph control callback in COMMIT event should hold the index of the cursor being moved by the user. The same applies to VAL_CHANGED event (see here). Now, while this is always true for VAL_CHANGED event, in case the commit event is raised by the user moving a cursor with the keyboard eventData1 is always = 1. This leads to incorrect data retrieval if you try to get plot values at cursor position for every cursor past the forst one. This can be easily observed in CVI example GraphCursors, function UpdateMarker.

 

A possible workaround is to call GetActiveGraphCursor and use the index retrieved by this function in subsequent calls to GetGraphCursor and / or GetGraphCursorIndex.

 

Tested on CVI 2009SP1 and 2010.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 1 of 5
(2,895 Views)

Hi Roberto,

 

What you're describing would be a bug, but I haven't been able to reproduce it yet.

 

I've been trying to reproduce it with samples\userint\graphcursors.prj. Are you able to reproduce it with this example program?

 

Luis

0 Kudos
Message 2 of 5
(2,863 Views)

Thanks for looking into this. I actually have to partially correct myself: the abnormal behaviour is shown only on snap-to-point cursors (which are the ones I am actually using in my project where I firstly got into this).

 

I modified CVI sample project adding two indicators for eventData1 and GetActiveGraphCursor received in graph callback: if you move any cursor with the mouse the two values are always the same; on the other hand, if you move cusror 2 by the keyboard eventData1 always have value 1, while GetActiveGraphCursor correctly shows value 2. See attached project.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 5
(2,851 Views)

Thanks, Roberto. That clears things up. There was in fact a bug in the graph cursor code. I've created bug report 391657 to track it.

 

Sorry about that, and thanks for letting us know about it.

 

Luis

0 Kudos
Message 4 of 5
(2,838 Views)

I'm happy that all is clear now. As you see there is an easy workaround so it's not a serious problem, once you've figured it out.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 5
(2,831 Views)