Object: MouseEvent
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”.
MouseEvent properties
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 methods
Method: MouseEvent.initMouseEvent()
The initMouseEvent() method initializes the value of a MouseEvent created by Document.createEvent(). This method can only be called before the MouseEvent has been dispatched.
Syntax
MouseEvent.initMouseEvent( typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, buttonArg, relatedTargetArg )
Parameters
Parameter |
Type |
Description |
|---|---|---|
typeArg |
String |
Specifies the MouseEvent type. This parameter may have one of the following values: |
canBubbleArg |
boolean |
When true, this parameter indicates that the event can bubble upwards through the DOM tree. This parameter sets the value of Event.bubbles. |
cancelableArg |
boolean |
When true, this parameter indicates that the event’s default action can be cancelled. This parameter sets the value of Event.cancelable. |
viewArg |
AbstractView |
Specifies the window or frame that is generating the event. This parameter sets the value of UIEvent.view. |
detailArg |
long |
Specifies the number of clicks associated with the event. This parameter sets the value of UIEvent.detail. |
screenXArg |
long |
Specifies the horizontal coordinate on the BlackBerry® device screen where the event occurred. |
screenYArg |
long |
Specifies the vertical coordinate on the BlackBerry device screen where the event occurred. |
clientXArg |
long |
Specifies the horizontal coordinate within the BlackBerry® Browser window where the event occurred. |
clientYArg |
long |
Specifies the vertical coordinate within the BlackBerry Browser window where the event occurred. |
ctrlKeyArg |
boolean |
Specifies whether the CTRL key was pressed during the event. |
altKeyArg |
boolean |
Specifies whether the ALT key was pressed during the event. |
shiftKeyArg |
boolean |
Specifies whether the SHIFT key was pressed during the event. |
metaKeyArg |
boolean |
Specifies whether the meta key was pressed during the event. |
buttonArg |
unsigned short |
Specifies which button was clicked. |
relatedTargetArg |
EventTarget |
Specifies the event’s related EventTarget. A value for this parameter is only necessary if typeArg has a value of “mouseover” or “mouseout”. Otherwise, this parameter should have a value of null. |