initMouseEvent method

Initializes a new mouse event that the IDocumentEvent::createEvent method created.

 

Syntax

HRESULT retVal = object.initMouseEvent(eventType, canBubble, cancelable, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, buttonArg, relatedTargetArg);

Parameters

eventType [in]

Type: BSTR

One of the following values, or a user-defined custom event type.

click

An HTMLFrameSiteEvents::onclick event. A mouse button is clicked over an element. A click is a mousedown event and mouseup event in the same location. The value of detailArg increases for each click in the same area.

dblclick

An HTMLFrameSiteEvents::ondblclick event. A mouse button is double-clicked over an element.

mousedown

An HTMLFrameSiteEvents::onmousedown event. A mouse button is pressed over an element.

mousemove

An HTMLFrameSiteEvents::onmousemove event. The mouse pointer moves over an element.

mouseout

An HTMLFrameSiteEvents::onmouseout event. The mouse pointer moves outside the boundaries of an element.

mouseover

An HTMLFrameSiteEvents::onmouseover event. The mouse pointer moves into the boundaries of an element.

mouseup

An HTMLFrameSiteEvents::onmouseup event. A mouse button is released over an element.

canBubble [in]

Type: VARIANT_BOOL

VARIANT_TRUE (true)

The event should propagate upward.

VARIANT_FALSE (false)

The event does not propagate upward.

cancelable [in]

Type: VARIANT_BOOL

VARIANT_TRUE (true)

The default action can be canceled.

VARIANT_FALSE (false)

The default action cannot be canceled.

viewArg [in]

Type: IHTMLWindow2

An IHTMLWindow2 variable that specifies the active window, or NULL. This value is returned in the IDOMUIEvent::view property of the event.

detailArg [in]

Type: long

A number that can provide additional information about the event. This value is returned in the IDOMUIEvent::detail property of the event.

screenXArg [in]

Type: long

The x-coordinate of the mouse pointer, relative to the upper-left corner of the screen. This value is returned in the IDOMMouseEvent::screenX property of the event.

screenYArg [in]

Type: long

The y-coordinate of the mouse pointer, relative to the upper-left corner of the screen. This value is returned in the IDOMMouseEvent::screenY property of the event.

clientXArg [in]

Type: long

The x-coordinate of the mouse pointer, relative to the upper-left corner of the browser's client area. This value is returned in the IDOMMouseEvent::clientX property of the event.

clientYArg [in]

Type: long

The y-coordinate of the mouse pointer, relative to the upper-left corner of the browser's client area. This value is returned in the IDOMMouseEvent::clientY property of the event.

ctrlKeyArg [in]

Type: VARIANT_BOOL

The value that is returned in the IDOMMouseEvent::ctrlKey property of the event.

VARIANT_TRUE (true)

The left or right Ctrl key is pressed.

VARIANT_FALSE (false)

Neither Ctrl key is pressed.

altKeyArg [in]

Type: VARIANT_BOOL

The value that is returned in the IDOMMouseEvent::altKey property of the event.

VARIANT_TRUE (true)

The left or right Alt key is pressed.

VARIANT_FALSE (false)

Neither Alt key is pressed.

shiftKeyArg [in]

Type: VARIANT_BOOL

The value that is returned in the IDOMMouseEvent::shiftKey property of the event.

VARIANT_TRUE (true)

The left or right Shift key is pressed.

VARIANT_FALSE (false)

Neither Shift key is pressed.

metaKeyArg [in]

Type: VARIANT_BOOL

The value that is returned in the IDOMMouseEvent::metaKey property of the event.

VARIANT_TRUE (true)

The left or right Meta/Command key is pressed.

VARIANT_FALSE (false)

Neither Meta/Command key is pressed.

buttonArg [in]

Type: unsigned short

The mouse button that caused the event. This value is returned in the IDOMMouseEvent::button property of the event.

relatedTargetArg [in]

Type: IEventTarget

A reference to the related element. For more information about how related elements are used with mouse events, see IDOMMouseEvent::relatedTarget.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information

See also

initPointerEvent

initGestureEvent