/
Input

Input

addEventHandler

function addEventHandler( event, callback )

Add a general event handler callback function.

The handler function should have the following signature: [function name]([parameters]). The parameters will vary depending on the event the function is attached to, as follows.

  • [onAlt] parameters = (bPressed)

    • This event is fired when the Alt key on the keyboard is pressed or released.

  • [onControl] parameters = (bPressed)

    • This event is fired when the Control key on the keyboard is pressed or released.

  • [onShift] parameters = (bPressed)

    • This event is fired when the Shift key on the keyboard is pressed or released.

Parameters

event   (string)   
The event to be captured (see function details)

callback   (function)   
The function to be called when the event triggers

getDragData

function getDragData()

Retrieves the data on the current drag and drop operation.

Return values

(dragdata)
A reference to a dragdata object, or nil if no drag is underway

getMouseButtonState

function getMouseButtonState(button)

Get the state of the specified mouse button.

Parameters

button   (number)   
This value specifies the mouse button whose state is being queried and should be 1 for the left mouse button, 2 for the middle button and 3 for the right button

Return values

(boolean)
Returns true if the button is pressed and false if it is not

getMousePosition

function getMousePosition()

Retrieve the current mouse pointer coordinates relative to the top left corner of the application window area.

Return values

(number)
The X coordinate of the mouse cursor(number)
The Y coordinate of the mouse cursor

isAltPressed

function isAltPressed()

Check the state of the alt key.

Return values

(boolean)
Returns true if the key is down, false otherwise

isControlPressed

function isControlPressed()

Check the state of the control key.

Return values

(boolean)
Returns true if the key is down, false otherwise

isShiftPressed

function isShiftPressed()

Check the state of the shift key.

Return values

(boolean)
Returns true if the key is down, false otherwise

removeEventHandler

function removeEventHandler( event, callback )

Remove a general event handler callback function.

Parameters should be the same as the event handler registration performed by addEventHandler API.

Parameters

event   (string)   
The event to be captured (see addEventHandler API)

callback   (function)
The event handling function to be removed

Related content