Scilab Function

seteventhandler - set an event handler for the current graphic window

### Sequence d'appel

  `seteventhandler(sfun_name)`
  `seteventhandler('')`

### Parametres

- `sfun_name` : a character string. The name of the Scilab function which is intended to handle the events

### Description

The function allows the user to set a particular event handler for the current graphic window. `seteventhandler('')` removes the handler. The event handler is defined by a Scilab function whose calling sequence must be `function sfun_name(win,x,y,ibut)`, where
- `win` represents the number of the window where the event had occured.
- `x,y` are the coordinates of the pointer (in pixels), when the event has occured
- `ibut`is the event type:

  `ibut==0` : Left mouse button has been pressed

  `ibut==-5` : Left mouse button has been released

  `ibut==1` : Middle mouse button has been pressed

  `ibut==-4` : Middle mouse button has been released

  `ibut==2` : Right mouse button has been pressed

  `ibut==-3` : Right mouse button has been released

  `ibut==-1` : pointer has moved

  `ibut > =32` : key with ascii code ascii(ibut) has been pressed

  `ibut < =-32` : key with ascii code ascii(-ibut) has been released

  `ibut==-1000` : graphic window has been closed

### Exemples

       function my_eventhandler(win,x,y,ibut)
           if ibut==-1 then
             [x,y]=xchange(x,y,'i2f')
             xinfo('Mouse position is ('+string(x)+','+string(y)+')')
           end
       endfunction
       plot2d()
       seteventhandler('my_eventhandler')
       //now move the mouse over the graphic window/
       seteventhandler('') //suppress the event handler

### Voir aussi

`addmenu` `xgetmouse` `xclick` `xchange`