Help Center

Local Navigation

Object: MouseEvent

Availability

BlackBerry® Device Software version 4.6 or later

Extends

UIEvent

The MouseEvent object extends the UIEvent object and represents an event generated by the BlackBerry® device trackball or trackwheel. It provides contextual information associated with clicking the trackball or trackwheel and moving the pointer in the BlackBerry® Browser window.

To create an instance of a MouseEvent, you must invoke Document.createEvent() with an input parameter of ”MouseEvent”.

Mouse event types

Event type

Bubbles

Cancelable

Description

click

yes

yes

Occurs when the user clicks the trackball or trackwheel on a BlackBerry® device, or, on touchscreen devices, when the user performs a tap.

This event type includes the following context information:

UIEvent.detail, MouseEvent.altKey, MouseEvent.button, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.ctrlKey, MouseEvent.metaKey, MouseEvent.screenX, MouseEvent.screenY, MouseEvent.shiftKey

mousedown

yes

yes

Occurs when the user depresses the trackwheel or trackball on a BlackBerry device.

This event type includes the following context information:

UIEvent.detail, MouseEvent.altKey, MouseEvent.button, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.ctrlKey, MouseEvent.metaKey, MouseEvent.screenX, MouseEvent.screenY, MouseEvent.shiftKey

mousemove

yes

no

Occurs when the user moves the pointer while it is over an element.

This event type includes the following context information:

MouseEvent.altKey, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.ctrlKey, MouseEvent.metaKey, MouseEvent.screenX, MouseEvent.screenY, MouseEvent.shiftKey

mouseout

yes

yes

Occurs when the user moves the pointer off of an element.

This event type includes the following context information:

MouseEvent.altKey, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.ctrlKey, MouseEvent.metaKey, MouseEvent.relatedTarget (indicating which EventTarget the pointer is leaving), MouseEvent.screenX, MouseEvent.screenY, MouseEvent.shiftKey

mouseover

yes

yes

Occurs when the user moves the pointer over an element.

This event type includes the following context information:

MouseEvent.altKey, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.ctrlKey, MouseEvent.metaKey, MouseEvent.relatedTarget (indicating which EventTarget the pointer is entering), MouseEvent.screenX, MouseEvent.screenY, MouseEvent.shiftKey

mouseup

yes

yes

Occurs when the user releases the trackwheel or trackball on a BlackBerry device.

This event type includes the following context information:

UIEvent.detail, MouseEvent.altKey, MouseEvent.button, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.ctrlKey, MouseEvent.metaKey, MouseEvent.screenX, MouseEvent.screenY, MouseEvent.shiftKey

MouseEvent properties

Property name

Type

Description

Status

Support level

Availability

altKey

boolean

Returns true if the ALT key is pressed or ALT lock is on.

read only

DOM 2 Events

4.6 or later

button

short

Returns a value indicating which mouse button changed state. Because BlackBerry® devices have a single button (the trackball,trackpad, or touchscreen), this parameter will always return a value of “0”.

read only

DOM 2 Events

4.6 or later

clientX

int

Returns the horizontal coordinate within the BlackBerry® Browser window where the event occurred.

read only

DOM 2 Events

4.6 or later

clientY

int

Returns the vertical coordinate within the BlackBerry Browser window where the event occurred.

read only

DOM 2 Events

4.6 or later

ctrlKey

boolean

Returns false. The BlackBerry device does not have a CTRL key.

read only

DOM 2 Events

4.6 or later

metaKey

boolean

Returns false. The BlackBerry device does not have a Meta key.

read only

DOM 2 Events

4.6 or later

relatedTarget

EventTarget

Returns the EventTarget that the pointer is moving over or moving off of.

read only

DOM 2 Events

4.6 or later

screenX

int

Returns the horizontal coordinate on the BlackBerry device screen where the event occurred.

read only

DOM 2 Events

4.6 or later

screenY

int

Returns the vertical coordinate on the BlackBerry device screen where the event occurred.

read only

DOM 2 Events

4.6 or later

shiftKey

boolean

Returns true if the SHIFT key is pressed.

read only

DOM 2 Events

4.6 or later

MouseEvent methods

Method name

Description

Support level

Availability

initMouseEvent()

Initializes the value of a MouseEvent.

DOM 2 Events

4.6 or later

Previous topic: MessageEvent methods

Was this information helpful? Send us your comments.