Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Right click generates 2 mousedown events??

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 214
Default Right click generates 2 mousedown events??

Hi Mike,
Yes, this problem is known for a long time.

Static Click As Integer
Click = Click + 1
If Not Click Mod 2 = 0 Then Exit Sub
' Your code

MP

"Mike" a écrit dans le message de news:
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Click Events on a MultiPage Geoff Excel Programming 0 November 11th 06 04:19 PM
Two double click events? PG Oriel Excel Programming 13 February 7th 06 07:51 PM
simulating click events ben Excel Programming 6 January 7th 05 04:26 PM
Click events on charts Steve Excel Programming 3 May 29th 04 03:26 AM
trapping click events on shapes Matt I Excel Programming 3 August 15th 03 08:17 PM


All times are GMT +1. The time now is 03:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"