devxlogo

Trapping a Double Click for a Toolbar Button

Trapping a Double Click for a Toolbar Button

VB4 supports the built-in Win95 Toolbar control, which allows users to add Buttons to the toolbar. The buttonhas a ButtonClick event, but if you want to trap a double-click, there is no ButtonDoubleClick event. To workaround this problem, declare two form level variables:

 Private mbSingleClicked As BooleanPrivate mbDoubleClicked As Boolean        In the Toolbars ButtonClick event, add this code:Private Sub Toolbar1_ButtonClick_        (ByVal Button As Button)Dim t As Singlet = TimerIf mbSingleClicked = True Then        mbDoubleClicked = True        MsgBox "Double Clicked"Else        mbSingleClicked = True        ' allow the user to click the next         ' time if he wants to double click        Do While Timer - t 

devx-admin

Share the Post: