I think that you will find that if you have the Single Click event
defined then the DoubleClick event will never fire
Basically you have to wait or rather set a flag then check whether the
next click is within 'double click time'
See the API GetDoubleClickTime
to find how long to wait
Option Explicit
Private Declare Function GetDoubleClickTime _
Lib "user32" () As Long
Private MaxWaitTime!
Private Sub Form_Load()
MaxWaitTime! = GetDoubleClickTime / 1000
Me.Caption = "Period" + Str$(MaxWaitTime!)
End Sub
Private Sub Command1_Click()
Static HoldTime!, Count%
Count = Count + 1
Select Case Count
Case 1: HoldTime = Timer
Case 2: HoldTime = 0: Exit Sub
Case Else: Exit Sub
End Select
While (Timer - HoldTime) <= MaxWaitTime
DoEvents
Wend
Me.Print "Clicks" + Str$(Count)
Me.Caption = Str$(Count)
Count = 0
End Sub
You can slicken things up in the DoEvents loop by having a background
Timer to fire a periodic message, and inserting WaitMessage (API)
before the DoEvents
HTH
On Thu, 27 Feb 2003 18:28:18 +0000, "P.R.Brady"
Quote:
>A VB6 query.
>I want to change a whole set of label captions if I single click any of
>them, but leave them unchanged and show a separate form if I double click.
>Naturally double clicking will generate two events - click and DblClick so
>I need to undo the change and reset the captions in the DblClick. This
>double change of captions is visible to the application user. Is there
>any simple and elegant way of delaying the single click handling until I
>know that a second one is not following?
>Thanks in anticipation
>Phil