MouseEvent.Button Property
Visio Automation Reference |
Returns the mouse button that was clicked to fire a MouseDown or MouseUp event. Read-only.
Version Information
Version Added: Visio 2003
Syntax
expression.Button
expression An expression that returns a MouseEvent object.
Return Value
Long
Remarks
Possible values for the Button property can be any of the constants shown in the following table, which are declared in VisKeyButtonFlags in the Visio type library.
Constant | Value |
---|---|
visMouseLeft |
1 |
visMouseMiddle |
16 |
visMouseRight |
2 |
Example
This class module shows how to define a sink class called MouseListener that listens for events fired by mouse actions in the active window. It declares the object variable vsoWindow by using the WithEvents keyword. The class module also contains event handlers for the MouseDown, MouseMove, and MouseUp events.
To run this example, insert a new class module in your Microsoft Visual Basic for Applications (VBA) project, name it MouseListener, and insert the following code in the module.
Visual Basic for Applications |
---|
|
Then, insert the following code in the ThisDocument project.
Visual Basic for Applications |
---|
|
Save the document to initialize the class, and then click anywhere in the active window to fire a MouseDown event. In the Immediate window, the handler prints the value that represents the mouse button that was clicked to fire the event.
See Also