Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
xgetmouse
get the mouse events and current position
Syntax
[rep [,win]]=xgetmouse([sel])
Arguments
- sel
boolean vector
[getmotion, getrelease]
. default value is[%t, %f]
- rep
vector of size 3, [x,y,ibutton].
- win
number of the figure where the event occurred.
Description
Despite xclick
, xgetmouse
does not prevent callback menu to be executed.
If the mouse pointer is located in the current graphics window, xgetmouse
returns
in rep
the current pointer position (x,y) and the value ibutton
.
The ibutton
value indicates the event type:
- 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==-5
Left mouse button has been released
- ibutton==-4
Middle mouse button has been released
- ibutton==-3
Right mouse button has been released
- ibutton==-1
pointer has moved
- ibutton > =32
key with ascii code ascii(ibutton) has been pressed
- ibutton < =-32
key with ascii code ascii(-ibutton) has been released
- ibutton > =1000+32
key with ascii code ascii(ibutton-1000) has been pressed while CTRL key pressed
- ibutton==-1000
graphic window has been closed
WARNING: In previous versions of Scilab (<5.0), the user could give a flag to precise if the mouse click event queue had to be cleared when entering xgetmouse. This option has been removed in Scilab 5.1.
Examples
// rectangle selection clf(); // erase/create window a=gca();a.data_bounds=[0 0;100 100];//set user coordinates xtitle(" drawing a rectangle ") //add a title show_window(); //put the window on the top [b,xc,yc]=xclick(); //get a point xrect(xc,yc,0,0) //draw a rectangle entity r=gce();// the handle of the rectangle rep=[xc,yc,-1];first=%f; while rep(3)==-1 do // mouse just moving ... rep=xgetmouse(); xc1=rep(1);yc1=rep(2); ox=min(xc,xc1); oy=max(yc,yc1); w=abs(xc-xc1);h=abs(yc-yc1); r.data=[ox,oy,w,h]; //change the rectangle origin, width a height first=%f; end
See also
- locate — mouse selection of a set of points in a 2D axes
- xclick — Attend une action d'un bouton de la souris, du clavier dans une fenêtre graphique.
- seteventhandler — set an event handler for the current graphic window
Report an issue | ||
<< xclick | Interactivité | Éclairage >> |