get_mposition
— Query the mouse position.
get_mposition( : : WindowHandle : Row, Column, Button)
get_mposition
returns the pixel 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 modifier 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:
No button,
Left button,
Middle button,
Right button,
Shift key,
Ctrl key,
Alt key.
The sum of the values for all pressed buttons/keys is returned in
Button
.
The origin of the coordinate system is located in the left upper
corner of the window. For graphics windows the coordinates Row
and Column
are expressed with consideration of the current
image part (see set_part
).
If subpixel accurate image coordinates are required, you can use the
operator get_mposition_sub_pix
.
get_mposition
fails (returns 5 (
H_MSG_FAIL)
) if the mouse pointer
is not located within the window. In this case, no values
are returned.
WindowHandle
(input_control) window →
(handle)
Window handle.
Row
(output_control) point.y →
(integer)
Row coordinate of the mouse cursor in the image coordinate system.
Column
(output_control) point.x →
(integer)
Column coordinate of the mouse cursor in the image coordinate system.
Button
(output_control) integer →
(integer)
Mouse button(s) pressed or 0.
get_mposition
returns the value 2 (
H_MSG_TRUE)
.
If the mouse pointer is not located within the
window, 5 (
H_MSG_FAIL)
is returned.
get_mbutton
,
get_mposition_sub_pix
,
get_mbutton_sub_pix
Foundation