# Class: MouseEvent

### LuxModule: gui

A mouseevent is produced whenever the mouse is moved, dragged, clicked or hits an object. A MouseEvent cannot be modified once it was created.

The x=0, y=0 coordinate is top-left, positive values go down / right. The event producing source might set the coordinate's origin to a different location. For example, the events that come from the GUI (i.e. Component) are in local component coordinates, where the topmost-leftmost corner is 0,0. The mouseevents that are created by the MouseCursor mouselisteners are in window coordinates.

## Methods:

### Method overview:

- MOUSE_CLICKED
- MOUSE_DOUBLECLICK
- MOUSE_DRAGGED
- MOUSE_ENTER
- MOUSE_EXIT
- MOUSE_MOVED
- MOUSE_PRESSED
- MOUSE_RELEASED
- MOUSE_WHEEL
- button
- doubleclicksensitivity
- downsince
- eventtype
- getDiff
- isClicked
- isDoubleClick
- isDragged
- isMoved
- isPressed
- isReleased
- isWheeled
- move
- new
- pwheel
- px
- py
- set
- src
- time
- toString
- wheel
- wheelmove
- x
- y

new (int x,y,wheel,previousx,previousy,previouswheel,button,eventtype,any src,downsince,time)
  returns: (MouseEvent)
  creates a new mouseevent object
MOUSE_CLICKED
  [int] - eventtype if a mousebutton was pressed and released without moving
MOUSE_DOUBLECLICK
  [int] - eventtype if the mouse event was a doubleclick
MOUSE_DRAGGED
  [int] - eventtype if the mouse was moved while holding a button
MOUSE_ENTER
  [int] - eventtype if the mouse entered the source
MOUSE_EXIT
  [int] - eventtype if the mouse exited the source
MOUSE_MOVED
  [int] - eventtype if the mouse was moved
MOUSE_PRESSED
  [int] - eventtype if a mousebutton is pressed down
MOUSE_RELEASED
  [int] - eventtype if the mouse was released
MOUSE_WHEEL
  [int] - eventtype if the mouse wheel was moved
button
  {[int]} - button that produced the mouseevent
doubleclicksensitivity
  [float=.275] - Minimum time for doubleclick sensitivity
downsince
  {[int]} - since which frame the mouse button was hold down
eventtype
  {[int]} - eventtype of the occured mouseevent
getDiff (MouseEvent)
  returns: (int x,y)
  returns difference between the two frames
isClicked (MouseEvent)
  returns: (boolean)
  true if the mouse was clicked
isDoubleClick (MouseEvent)
  returns: (boolean)
  true if the mouse was doubleclicked
isDragged (MouseEvent)
  returns: (boolean)
  true if the mouse was dragged
isMoved (MouseEvent)
  returns: (boolean)
  true if the mouse was moved
isPressed (MouseEvent)
  returns: (boolean)
  true if the mouse was pressed
isReleased (MouseEvent)
  returns: (boolean)
  true if the mouse was released
isWheeled (MouseEvent)
  returns: (boolean)
  true if the wheel was moved
move (MouseEvent self, int x,y)
  returns: (MouseEvent)
  returns new Mouseevent with translated coordinates with given x,y
pwheel
  {[int]} - previously wheel position of mouse
px
  {[int]} - previous position of the mouse when mouseevent was produced
py
  {[int]} - previous position of the mouse when mouseevent was produced
set (MouseEvent self, int x,y,[wheel])
  returns: (MouseEvent)
  returns new Mouseevent with new coordinates set to x and y, respecting the previous position.
src
  {[int]} - source object that produced the mouseevent if available
time
  {[int]} - time in seconds when event occurred
toString
  {string}:(MouseEvent e) - returns a string representing the mouseevent. This function is called if the MouseEvent is converted to a string, i.e. when calling 'print(mymouseevent)'.
wheel
  {[int]} - wheel position of mouse
wheelmove
  {[int]} - difference between current and previous wheelposition
x
  {[int]} - position of the mouse when mouseevent was produced. Depending on the event producer, these can be local (component) coordinates. (0,0) is top left, (+,+) is bottom right.
y
  {[int]} - position of the mouse when mouseevent was produced. Depending on the event producer, these can be local (component) coordinates.