MouseUp Event
Object List Next Object
Defined By: Window
Description:
Occurs when the user presses any mouse button. Often used with the
corresponding MouseDown event to define what occurs when a mouse button is pressed and
released.
Usage:
Sub MouseUp(button As Integer, shift As Integer, x As Single, y As Single)
Syntax Description
button The button released to trigger the event. The button argument sets bits that correspond
to the following values: 1 for the left button, 2 for the right button, and 4
for the middle button. Only one bit is set at a time.
shift The status of the SHIFT, CTRL, and ALT keys when the specified button was released. Each of these keys has a corresponding value. SHIFT has a value
of 1, CTRL is 2, and ALT is 4. To indicate which key or keys were pressed, the
key values are added to the shift argument. For example, if only CTRL is released, the value of shift is 2.
x, y The x and y coordinates defining the current location of the mouse pointer. x and y are single-precision variables that use the coordinate system established by
the object's ScaleHeight, Scale Width, ScaleLeft, and ScaleTop properties.
Details:
The arguments included in the MouseDown event allow you to indicate the status
of the mouse at the time the event is called. In addition to using a MouseDown
procedure to determine that a mouse button has simply been released, you can
also determine which mouse button was released, and what combination of the
SHIFT, ALT, or CTRL keys were pressed, when the button was released. You can also
specify different actions that you would like to occur based on which mouse
button is released.
MouseDown events allow you to distinguish between the left, right, and middle
mouse buttons; the Click and DblClick events do not. When a mouse button is
pressed while the pointer is over a form or control, that object essentially owns
the mouse and receives all mouse events until the MouseUp event is processed.
If the mouse pointer leaves the area of the form or object before the MouseUp
event, the x, y mouse-pointer coordinates received could be from outside of the
receiving form or control.
If a series of mouse buttons are pressed, the object that receives the second
mouse action (the action after the first mouse click) will own all subsequent
mouse events until all buttons are released.
To test for the button or shift arguments you can use logical operators. The virtual constants you can use to
test for various combinations of buttons are listed as follows:
Virtual Constant Value
LEFT_BUTTON 1
RIGHT_BUTTON 2
MIDDLE_BUTTON 4
SHIFT_MASK 1
CTRL_MASK 2
ALT_MAST 4
When using a MouseMove procedure, please note that the button argument indicates the current state of all buttons; whereas, the button argument for MouseUp indicates only one button for each event. MouseMove
procedures are often used to react to events generated by moving the mouse.
See Also:
Click, DblClick events; MouseDown, MouseMove events; MousePointer property