View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Right click generates 2 mousedown events??

Mike,
I can confirm that behaviour in XL+Word 2000 and also in XL2002. Can't find
an explanation anywhere at the moment, but may be something to do with the
menu item that can appear to cut/copy etc the text in a TextBox.
e.g. ListBox (not editable) does not show this behaviour, but a comboBox
(editable) does.

You could test for the right button, or more correctly the non-primary
button. Something like this:

Dim ProcessClick As Boolean

Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Button < xlPrimaryButton Then
ProcessClick = Not ProcessClick

If ProcessClick = False Then
Exit Sub
End If
End If
'Your code
End Sub

NickHK

"Mike" wrote in message
...
When I right click in a TextBox, it generates two mousedown events. Is

this
normal, or do I have a problem? Code below illustrates the "problem".

thanks for any insight!!

Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Static i As Integer
i = i + 1
Debug.Print i
End Sub

Immediate Window:
1
2