LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do get Mouse-position in graph under CVI?

I looked at article:

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000BE9D0000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=mouse&USEARCHCONTEXT_QUESTION_S=0

But I have the same question under LabWindows/CVI.

I have an thread running that wakes up when the mouse cursor goes into the graph. However, when I use

GetGraphCursor (handle, PANEL_GRAPH, curNum, &x, &y)

I always get (x,y) = (0.0,0.0). Is there another Mouse-position function that I should use?
0 Kudos
Message 1 of 3
(3,668 Views)
GetGraphCursor function returns the position of the cursor on the graph. The cursor is the ruler placed on a plot in the graph. It does not refers to mouse position.

To get the mouse position there are two ways:
1. Wait for the user to click anyway in the panel or on some control and intercept EVENT_LEFT_CLICK or EVENT_RIGHT_CLICK in the panel or control callback
2. Use extended mouse events. Use the EnableExtendedMouseEvents () function to enable intercepting of mouse movements for some control (e.g. your graph). The control callback will be triggered with the pacing you set in Minimum Event Interval parameter.


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 2 of 3
(3,668 Views)
Actually, I was looking for movement of the mouse (without left/right clicking) within the black-portion of the graph. My graph's limits are -20.0 to +20.0 degrees. When the user moves the mouse within the graph (not the label area), the value I need to get is -20.0 to +20.0:
- I tried using
GetRelativeMouseState(handle,PANEL_GRAPH, &x,&y,0,0,0)

- but it gave me coordinates including the label area of the control. I "jerry-rigged" it to give me values of -20.0 to +20.0 within the graph itself, and 0.0 if within the label area.
= the accuracy of this method is very low...

There HAS to be a better way...
0 Kudos
Message 3 of 3
(3,668 Views)