Share via


button Property

Returns a Long that represents whether the user is pressing the mouse button.

expression.button

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Remarks

This property is generally used with the onmousedown, onmouseup, and onmousemove events.

Example

The following example displays a message when a user moves the mouse pointer over the application window, telling the user whether the mouse button is being clicked. This example must be placed in a class module.

Note  Place the winFP and docFP variables declared using the WithEvents keyword in the General Declarations section of the class module.

Private WithEvents winFP As FPHTMLWindow2
Private WithEvents docFP As FPHTMLDocument

Private Sub docFP_onmousemove()
    Dim objEvent As IHTMLEventObj

    Set objEvent = winFP.event
    
    Select Case objEvent.Button
        Case 0
            MsgBox "No mouse button is being clicked."
        Case 1
            MsgBox "You are clicking your mouse button."
    End Select
End Sub

Applies to | IHTMLEventObj Object