Scilab Function

xgetmouse - get the mouse events and current position

### Calling Sequence

  `rep=xgetmouse([flag], [sel])`

### Parameters

- `flag` : integer. If present, the mouse click event queue is not cleared when entering xgetmouse.
- `sel` : boolean vector `[getmotion, getrelease]` . default value is `[%t, %f]`
- `rep` : vector of size 3, [x,y,ibutton].

### Description

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:

  -if ibutton is -1 then a mouse motion' was got (if `getmotion` has been set to %t) .
  -if ibutton is -5 -4 or -2 then left , middle or right button' was released (if `getrelease` has been set to %t).
  -if ibutton is 0, 1 or 2, then the left, middle or right button'> was pressed. If the mouse is not located in the current graphics window, `xgetmouse` waits. Moreover, `xgetmouse` works in a synchonous way, i.e. waits for a mouse event (click or pointer movement) to occur before exiting.

### Examples

    xselect(); xbasc(); xsetech([0 0 1 1],[0 0 100 100])
    xset("alufunction",6)
    xtitle(" drawing a rectangle ")
    [b,x0,y0]=xclick(); rep=[x0,y0,-1]; x=x0; y=y0;
    xrect(x0,y0,x-x0,y-y0)
    while rep(3)==-1 then
        rep=xgetmouse(0)
        xrect(x0,y0,x-x0,y0-y)
        x=rep(1); y=rep(2);
        xrect(x0,y0,x-x0,y0-y)
    end
    xset("alufunction",3)

### See Also

`locate` , `xclick` ,

### Author

S. Steer