The behavior of the list control in Visual Basic 6 is as follows.
1) When you click on an item the click event is fired.
2) When you click on the SAME item the click event is still fired.
3) When you double click on the item both the click event and double click event are fired.
Note #2. What you need to do is have a currentitem in the form you working with. Everytime the click event is checked you first see if the current item is the same item as what you clicked. If it is NOT the same item you process the click event normally.
If you double click on a NEW Item then the user is doing two things at the same time. Selecting a new item and performing the double click item. In this case the click is fired first then the double click.
This sequence is no different than if the control did what you wanted it to. It is the same as if you clicked on a new item wait X second then double click the same item.
If your click event involves handing off the task to a ActiveX EXE and immediately terminating or setting data to be processed later by a background timer. Then you need to have a semaphore or a flag to indicate when the process spawned by the click event is done. The Double Click event won't be processed until the semaphore is cleared.
If you have additional details my answer can be more specific. The following is some code you can run to see the List Box in actions. Create a Form and add three items to the list. Then add the below code.
Private Sub List1_Click()
Print "Clicked - " & Me.List1.List(Me.List1.ListIndex)
End Sub
Private Sub List1_DblClick()
Print "Double Clicked - " & Me.List1.List(Me.List1.ListIndex)
End Sub
Do the following steps
- Click on Item #1
- Click on Item #2
- Click on Item #2 again
- Double Click on Item #2
- Double Click on Item #3
You will see the various combination of actions occuring.