get_mposition_sub_pix — Query the subpixel mouse position.
get_mposition_sub_pix returns the subpixel accurate image coordinates of the mouse pointer in the output window and the mouse button pressed. These values are returned regardless of the state of the mouse buttons (pressed or not pressed). If at least one mouse button is pressed, the state of the modfier keys is returned as well. If no mouse button is pressed, get_mposition returns 0 in Button, even if a modifier key is pressed. The following values are assigned to the individual buttons and keys:
The sum of the values for all pressed buttons/keys is returned in Button.
For graphics windows the coordinates Row and Column are expressed with consideration of the current image part (see set_part). For text windows the coordinates of the upper left corner are (-0.5,-0.5), while the coordinates of the lower right corner are (window height-0.5,window width-0.5) (see open_textwindow).
If only pixel accurate image coordinates are required, you can use the operator get_mposition.
get_mposition_sub_pix fails (returns FAIL) if the mouse pointer is not located within the window. In this case, no values are returned.
Row coordinate of the mouse position in the window.
Column coordinate of the mouse position in the window.
Mouse button(s) pressed or 0.
If the mouse pointer is not located within the window, 5 (H_MSG_FAIL) is returned.
get_mbutton, get_mposition, get_mbutton_sub_pix