LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetRelativeMouseState relative to what ??

Using CVI 8.1.1:

the documentation for GetRelativeMouseState states reads like this:

"Obtains information about the state of the mouse cursor. xCoordinate and yCoordinate return the position of the mouse relative to the top and left coordinates of a specific control. If you pass zero as the controlID, the coordinate information references the top and left coordinates of the panel, excluding the panel frame and title bar. GetRelativeMouseState returns the coordinates even if the mouse is not over the control or the panel."

So, how comes i get the mouse position relative to the panel ?? controlID is not 0 and is a valid control handle since any other functions uses it without any problem. The control mentionned here is a canvas.
Also, the documentation does not states what happens if controlID is an incorrect handle. I assume it will not return an error since NO error code is listed in the "return value" section.

I may not be right, but i think something is wrong with the documentation of this function...
0 Kudos
Message 1 of 2
(3,201 Views)
Ok, forget about it: GetRelativeMouseState returns the mouse position relative to the control.

The problem is not in GetRelativeMouseState, but rather in the event handler for a control: the callback function is attached to a CONTROL (using InstallCtrlCallback), and for every mouse event on the CONTROL, we receive mouse positions relative to the PANEL ! fairly intuitive...

(but the point about what happens if we pass an invalid control handle to GetRelativeMouseState is still valid)
0 Kudos
Message 2 of 2
(3,198 Views)