Microsoft DirectAnimation Controls - MouseEventsEnabled Property and Mouse Events


MouseEventsEnabled Property

Description

This property determines whether Mouse events are to be processed against the object. Mouse events are processed against the visible pixels of the structured graphic or sprite object. Read/write at run time; write access is available at run time only when the sprite is stopped.

Syntax

PARAM Tag Syntax

<PARAM NAME="MouseEventsEnabled" VALUE="0 | 1"> 

Syntax

Script Syntax

object.MouseEventsEnabled [=fBoolean]

ParameterDescription
object Name of the Structured graphics or Sprite object, as defined in PARAM tag syntax.
0 | 1, fBoolean Boolean flag that determines whether to process mouse events. For Structured Graphics, the default is False. For Sprite, the default is True. In HTML Param tags, the possible values are 0 (false) or nonzero (true). In script the flag can support either 0 or False, 1 (a nonzero value) or True.

Remarks

Mouse events are z-order dependent. For example, if you have two objects positioned over top of each other, whichever object has a higher z-order will receive the Mouse event when you click, release, or move over that region.

Structured Graphics note: Enabling this property turns on a 1-bit hit mask for the control which slows down its rendering when it's being manipulated. For optimal performance, turn this property off unless you're specifically using it. Mouse events are not processed against the outline of the shape.


onclick Event

Description

Occurs when the left mouse button is depressed and released while the mouse pointer is inside of the region contained by the object's boundaries. A click event can also occur by hitting enter on an object with focus. The click event follows the onmouseup event when it occurs as a result of a mouse button click.

Syntax

VBScript Syntax

Sub object_onclick
     script
End Sub

JScript Syntax

<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onclick>
script
</SCRIPT>

ParameterDescription
object String identifying the Sprite or Structured Graphics object.
script Script to be executed when the event occurs.


ondblclick Event

Description

Occurs when the left mouse button is depressed and released twice in quick succession while the mouse pointer is inside of the region contained by the object's boundaries.

Syntax

VBScript Syntax

Sub object_ondblclick
     script
End Sub

JScript Syntax

<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=ondblclick>
	script
</SCRIPT>

ParameterDescription
object String identifying the Sprite or Structured Graphics object.
script Script to be executed when the event occurs.

Remarks

The sequence of events for a double-click event is as follows:

  1. onmousedown
  2. onmouseup
  3. onclick
  4. onmouseup
  5. ondblclick

The timing of click events are controlled by the Mouse settings found in the Control Panel.


onmousedown Event

Description

Fires when the left mouse button is pushed down while the pointer is within the region contained by the object.

Syntax

VBScript Syntax

Sub object_onmousedown(button, shift, x, y)
     script
End Sub

JScript Syntax

<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onmousedown(button, shift, x, y) >
     script
</SCRIPT>

ParameterDescription
object String identifying the Sprite or Structured Graphics object.
button d>Bit field indicating whether the left (bit 0), right (bit 1), or middle (bit 2) mouse buttons are pressed. Returns the value of the mouse button pressed; 0 for no buttons pressed, 1 for left button pressed, 2 for right button pressed, 4 for middle button pressed.
shift Bit field indicating whether the SHIFT (bit 0), CTRL (bit 1), or ALT (bit 2) keys are pressed. Returns the value of the key pressed while the mouse event is taking place; 0 for no key pressed, 1 for Shift key pressed, 2 for Ctrl key pressed, 3 for Shift and Ctrl keys pressed simultaneously, 4 for Alt key pressed, 5 for Shift and Alt keys pressed simultaneously, 6 for Ctrl and Alt keys pressed simultaneously, 7 for Shift, Ctrl and Alt keys pressed simultaneously.
x, y Coordinates that specify the location of the mouse pointer. Coordinates are in pixels, relative to the surrounding container, with the origin in the upper-left corner.
script Script to be executed when the event occurs.


onmousemove Event

Description

Fires when the mouse pointer is moved in the region contained by the object.

Syntax

VBScript Syntax

Sub object_ onmousemove(button, shift, x, y)
     script
End Sub

JScript Syntax

<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onmousemove(button, shift, x, y) >
     script
</SCRIPT>

ParameterDescription
object String identifying the Sprite or Structured Graphics object.
button Bit field indicating whether the left (bit 0), right (bit 1), or middle (bit 2) mouse buttons are pressed. Returns the value of the mouse button pressed while the mouse event is taking place; 0 for no buttons pressed, 1 for left button pressed, 2 for right button pressed, 3 for left and right buttons pressed, 4 for middle button pressed, 5 for left and middle buttons pressed simultaneously, 6 for right and middle buttons pressed simultaneously, 7 for left, right and middle buttons pressed simultaneously.
shift Bit field indicating whether the SHIFT (bit 0), CTRL (bit 1), or ALT (bit 2) keys are pressed. Returns the value of the key pressed while the mouse event is taking place; 0 for no key pressed, 1 for Shift key pressed, 2 for Ctrl key pressed, 3 for Shift and Ctrl keys pressed simultaneously, 4 for Alt key pressed, 5 for Shift and Alt keys pressed simultaneously, 6 for Ctrl and Alt keys pressed simultaneously, 7 for Shift, Ctrl and Alt keys pressed simultaneously.
x, y Coordinates that specify the location of the mouse pointer. Coordinates are in pixels, relative to the surrounding container, with the origin in the upper-left corner.
script Script to be executed when the event occurs.


onmouseout Event

Description

Occurs when the mouse pointer is moved out of the region contained by the object's boundaries.

Syntax

VBScript Syntax

Sub object_onmouseout
     script
End Sub

JScript Syntax

<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onmouseout>
     script
</SCRIPT>

ParameterDescription
object String identifying the Sprite or Structured Graphics object.
script Script to be executed when the event occurs.


onmouseover Event

Description

Fires when the mouse pointer is moved into the region contained by the object from a region outside of the object's boundaries.

Syntax

VBScript Syntax

Sub object_onmouseover
     script
End Sub

JScript Syntax

<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onmouseover>
     script
</SCRIPT>

ParameterDescription
object String identifying the Sprite or Structured Graphics object.
script Script to be executed when the event occurs.

mouseover example Right click inside the frame and View Source to get source code.



onmouseup Event

Description

Fires when the left mouse button is released (from a depressed position) while the pointer is within the region contained by the object.

Syntax

VBScript Syntax

Sub object_ onmouseup(button, shift, x, y)
     script
End Sub

JScript Syntax

<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onmouseup(button, shift, x, y) >
     script
</SCRIPT>

ParameterDescription
object String identifying the Sprite or Structured Graphics object.
button Bit field indicating whether the left (bit 0), right (bit 1), or middle (bit 2) mouse buttons are released. Returns the value of the mouse button released; 0 for no buttons released, 1 for left button released, 2 for right button released, 4 for middle button released.
shift Bit field indicating whether the SHIFT (bit 0), CTRL (bit 1), or ALT (bit 2) keys are pressed. Returns the value of the key pressed while mouse event is taking place; 0 for no key pressed, 1 for Shift key pressed, 2 for Ctrl key pressed, 3 for Shift and Ctrl keys pressed simultaneously, 4 for Alt key pressed, 5 for Shift and Alt keys pressed simultaneously, 6 for Ctrl and Alt keys pressed simultaneously, 7 for Shift, Ctrl and Alt keys pressed simultaneously.
x, y Coordinates that specify the location of the mouse pointer. Coordinates are in pixels, relative to the surrounding container, with the origin in the upper-left corner.
script Script to be executed when the event occurs.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.