Type Event Revision Release 2021.3646 Keywords mouse
Mouse events occur when the mouse cursor moves or when the mouse buttons have been pressed or released. This event provides information about the mouse cursor's current screen coordinates and its button states.
Note that a mouse will generate touch events while holding the primary mouse button down.
Also note that a mouse will generate tap events when clicking the primary mouse button. The tap's event.numTaps property will be set to 1 when single clicking and 2 when double clicking. A tap event will not be raised when clicking any other mouse button.
Only Android 3.1 or higher devices support a mouse via bluetooth or USB.
Android 4.0 and higher devices support the mouse's secondary and middle buttons.
Does not support mouse events.
The Corona Simulator for macOS and macOS desktop apps support mouse events.
The Corona Simulator for Windows and Win32 desktop apps support mouse events. However, in the Corona Simulator, mouse events are only provided when simulating an Android device.
Mouse events will not be received while the mouse cursor is outside of the application window, such as when you drag the cursor on top of Android's bottom navigation bar.
-- Called when a mouse event has been received. local function onMouseEvent( event ) if event.type == "down" then if event.isPrimaryButtonDown then print( "Left mouse button clicked." ) elseif event.isSecondaryButtonDown then print( "Right mouse button clicked." ) end end end -- Add the mouse event listener. Runtime:addEventListener( "mouse", onMouseEvent )