Wait for a mouse click or an event in a graphic window.
[ibutton,xcoord,yxcoord,iwin,cbmenu]=xclick([flag])
Real scalar (integer value): mouse button number, event code... (See description below).
Real scalar: x-coordinate of the mouse pointer when the click or event occurred, in current graphic scale (see gca()).
Real scalar: y-coordinate of the mouse pointer when the click or event occurred, in current graphic scale (see gca()).
Real scalar (integer value): number of the window where the action occurred.
String: callback associated to a menu if
xclick
returns due to a click on a menu. In this
case, ibutton
, xcoord
,
ycoord
, and iwin
take
arbitrary values.
Real scalar (integer value): If present, the click event queue is not cleared when entering xclick.
xclick
waits for a mouse click, a keyboard event, a menu activation or windows closure in the graphics
window. xclick
prevents menu callback to be executed. Callback will be returned in cbmenu
return value.
If it is called with 3 left hand side arguments, it waits for a mouse click in the current graphics window.
If it is called with 4 or 5 left hand side arguments, it waits for a mouse click in any graphics window.
![]() |
The values of ibutton
are described below.
Left mouse button has been pressed.
Middle mouse button has been pressed.
Right mouse button has been pressed.
Left mouse button has been clicked.
Middle mouse button has been clicked.
Right mouse button has been clicked.
Left mouse button has been double-clicked.
Middle mouse button has been double-clicked.
Right mouse button has been double-clicked.
key with ASCII code ibutton
has been
pressed.
key with ASCII code -ibutton
has been
released.
key with ASCII code ibutton-1000
has been
pressed while CTRL key pressed.
graphic window has been closed.
A dynamic menu has been selected and its callback is returned
in cbmenu
.
Version | Description |
5.0 | Closing a figure now returns the event code -1000 instead of -100. |