Solved Command button with both single click event and ctrl click event.

Mike Krailo

Well-known member
Local time
Today, 14:26
Joined
Mar 28, 2020
Messages
1,688
Just wondering if it is possible to both single click on a command button to trigger a normal event and launch different code using ctrl-click on the same button? I also tried both single and double click events on the same button and the single click event seems to override the double click event. Then I thought that it would be nice to modify the event code using Ctrl-Click which would be desirable. Right now the form in question has a simple check box which must be set or unset to achieve the desired results using standard logic in the on click event.
 
What about?

Code:
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Shift = 1 Then
    MsgBox "Do something for shift"
  Else
    MsgBox "do somethig for No Shift"
  End If
End Sub
 
Works perfectly.
 

Users who are viewing this thread

Back
Top Bottom