Click Event

Applies to:  MouseEvents
See also:  Window object, MouseDown event, MouseUp event

Occurs when the user presses and releases a mouse button within the same window.

Syntax:

Public Event Click(ByRef Window As Window, ByVal Button As MouseButtonConstants, ByVal Shift As Boolean, ByVal Control As Boolean, ByVal x As Long, ByVal y As Long)

The Click event syntax has these parts:

Part Description
object The name of a MouseEvents object.  NB:  object must be declared using WithEvents.
Window The window in which the mouse button was clicked.
Button A value indicating which button was clicked.  Can be one of vbLeftButton, vbMiddleButton, vbRightButton.
Shift A boolean value indicating the state of the shift button.  A vale of True indicates that the shift key is down.
Control A boolean value indicating the state of the ctrl button.  A vale of True indicates that the ctrl key is down.
x The x coordinate of the mouse pointer, in client coordinates (pixels).  May be negative, if the mouse is over the border or caption of a top-level or mdi child window.
y The y coordinate of the mouse pointer, in client coordinates (pixels).  May be negative, if the mouse is over the border or caption of a top-level or mdi child window.

Remarks:

The Click event cannot be cancelled directly, because it is not a low-level event.  To prevent a Click event, process and cancel the MouseDown event

Example:

Trapping mouse events

 

Home Copyright and Disclaimer