VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Testing to see if the left or right mouse button is pressed

1 REPLY 1
Reply
Message 1 of 2
Anonymous
173 Views, 1 Reply

Testing to see if the left or right mouse button is pressed

Hi

I want to use the buttons as an answer mechanism e.g. left button press =
Yes, right = No.

In lisp I used getpoint to test. if the return value was a point = yes.

I've tried that in VBA but I'm not getting very far. If the right button is
pressed the return value is Empty, but I don't know how to test for this.

This is as far as I've got (which is not very):

Sub LayerThaw()
Dim Pt1 As Variant
' On Error Resume Next
Pt1 = ThisDrawing.Utility.GetPoint(, "Left = Pick,Right= Dialogue")
If Pt1 Is Empty Then
Debug.Print "right button"
Else
Debug.Print "left button"
End If
End Sub

Any ides how, or is there a better way?

Thanks in advance

Dave
1 REPLY 1
Message 2 of 2
Anonymous
in reply to: Anonymous

Hi David,

One possibility would be to set a flag in the "BeginRightClick" event of the
Document object.

Something like the snip below.

Gary

Option Explicit
Public rClick As Boolean

Private Sub AcadDocument_BeginRightClick(ByVal PickPoint As Variant)

rClick = True

End Sub

Sub LayerThaw()
Dim Pt1 As Variant
On Error Resume Next
Pt1 = ThisDrawing.Utility.GetPoint(, "Left = Pick,Right= Dialogue")
If rClick Then
MsgBox "right button"
rClick = False
Else
MsgBox Pt1(0) & "," & Pt1(1) & "," & Pt1(2)
End If
End Sub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost