Index Topic Contents | |||
Previous Topic: Structured Graphics Control Next Topic: Windows Metafile to Structured Graphics Converter |
MouseEventsEnabled Property and Mouse Events
This section describes how to enable your control to respond to the mouse. It contains the following topics:
- MouseEventsEnabled Property
- onclick Event
- ondblclick Event
- onmousedown Event
- onmousemove Event
- onmouseout Event
- onmouseover Event
- onmouseup Event
MouseEventsEnabled PropertyDetermines whether mouse events will 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.
PARAM Tag Syntax
<PARAM NAME="MouseEventsEnabled" VALUE="0 | 1">
Script Syntax
object.MouseEventsEnabled [=fBoolean]Parameters
- object
- Name of the Structured Graphics or Sprite object, as defined in PARAM tag syntax.
- 0 | 1, fBoolean
- Boolean flag that specifies 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 on top of each other, whichever object has a higher z-order will receive the mouse event when the user clicks, releases, or moves over that region.
Structured Graphics note: Enabling this property turns on a 1-bit bit mask for the control that 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 EventOccurs when the left mouse button is depressed and released while the mouse pointer is inside the region contained by the object's boundaries. An onclick event can also occur by hitting the ENTER key when an object has focus. The onclick event follows the onmouseup event when it occurs as a result of a mouse button click.
VBScript Syntax
Sub object_onclick
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onclick>
script
<SCRIPT>Parameters
- object
- String identifying the Sprite or Structured Graphics object.
- script
- Script to be executed when the event occurs.
ondblclick EventOccurs when the left mouse button is depressed and released twice in quick succession while the mouse pointer is inside the region contained by the object's boundaries.
VBScript Syntax
Sub object_ondblclick
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=ondblclick>
script
<SCRIPT>Parameters
- object
- String identifying the Sprite or Structured Graphics object.
- script
- Script to be executed when the event occurs.
Remarks
The sequence of events for an ondblclick event is as follows:
- onmousedown
- onmouseup
- onclick
- onmouseup
- ondblclick
The user can control the timing of click events by changing the Mouse settings found in the Control Panel.
onmousedown EventFires when the left mouse button is pushed down while the pointer is within the region contained by the object.
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>Parameters
- 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 a value that specifies which mouse button was 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 a value that specifies the key or keys 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 EventFires when the mouse pointer is moved in the region contained by the object.
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>Parameters
- 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 EventOccurs when the mouse pointer is moved out of the region contained by the object's boundaries.
VBScript Syntax
Sub object_onmouseout
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onmouseout>
script
<SCRIPT>Parameters
- object
- String identifying the Sprite or Structured Graphics object.
- script
- Script to be executed when the event occurs.
onmouseover EventFires when the mouse pointer is moved into the region contained by the object, from a region outside the object's boundaries.
VBScript Syntax
Sub object_onmouseover
script
End Sub
JScript Syntax
<SCRIPT LANGUAGE="JavaScript" FOR=object EVENT=onmouseover>
script
<SCRIPT>Parameters
- object
- String identifying the Sprite or Structured Graphics object.
- script
- Script to be executed when the event occurs.
onmouseover example Right click inside the frame and choose View Source to get source code.
onmouseup EventFires when the left mouse button is released (from a depressed position) while the pointer is within the region contained by the object.
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>Parameters
- 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.
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.