xclick
Wait for a mouse click or an event in a graphic window.
Syntax
[ibutton,xcoord,yxcoord,iwin,cbmenu]=xclick([flag])
Arguments
- ibutton
Real scalar (integer value): mouse button number, event code... (See description below).
- xcoord
Real scalar: x-coordinate of the mouse pointer when the click or event occurred, in current graphic scale (see gca()).
- ycoord
Real scalar: y-coordinate of the mouse pointer when the click or event occurred, in current graphic scale (see gca()).
- iwin
Real scalar (integer value): number of the window where the action occurred.
- cbmenu
String: callback associated to a menu if
xclick
returns due to a click on a menu. In this case,ibutton
,xcoord
,ycoord
, andiwin
take arbitrary values.- flag
Real scalar (integer value): If present, the click event queue is not cleared when entering xclick.
Description
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.
- ibutton==0
Left mouse button has been pressed.
- ibutton==1
Middle mouse button has been pressed.
- ibutton==2
Right mouse button has been pressed.
- ibutton==3
Left mouse button has been clicked.
- ibutton==4
Middle mouse button has been clicked.
- ibutton==5
Right mouse button has been clicked.
- ibutton==10
Left mouse button has been double-clicked.
- ibutton==11
Middle mouse button has been double-clicked.
- ibutton==12
Right mouse button has been double-clicked.
- ibutton >=32
key with ASCII code
ibutton
has been pressed.- ibutton <= -32
key with ASCII code
-ibutton
has been released.- ibutton >=1000+32
key with ASCII code
ibutton-1000
has been pressed while CTRL key pressed.- ibutton==-1000
graphic window has been closed.
- ibutton==-2
A dynamic menu has been selected and its callback is returned in
cbmenu
.
See also
- gca — Return handle of current axes.
- locate — mouse selection of a set of points in a 2D axes
- xgetmouse — get the mouse events and current position
- seteventhandler — set an event handler for the current graphic window
History
Version | Description |
5.0 | Closing a figure now returns the event code -1000 instead of -100. |
Report an issue | ||
<< twinkle | interaction | xgetmouse >> |