Please note that the recommended version of Scilab is 6.1.1. This page might be outdated.
See the recommended documentation of this function
get the mouse events and current position
[getmotion, getrelease]. default value is
vector of size 3, [x,y,ibutton].
number of the figure where the event occurred.
If the mouse pointer is located in the current graphics window,
rep the current pointer position (x,y) and the value
ibutton value indicates the event type:
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
Left mouse button has been released
Middle mouse button has been released
Right mouse button has been released
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
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.
// 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 retangle origin, width an height first=%f; end
|<< xclick||interaction||load_save >>|