|
|
Title | Display multiple popups depending on whether Ctrl or Shift is pressed |
Description | This example shows how to display multiple popups depending on whether Ctrl or Shift is pressed in Visual Basic 6. |
Keywords | popup menu, popup, context menu, PopupMenu, Ctrl, Shift |
Categories | Controls, Software Engineering |
|
|
Thanks to Chris Wagg.
In the MouseDown event handler, check the Shift parameter to see if Ctrl of Shift was pressed and display the appropriate popup.
|
|
Private Sub Form_MouseDown(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
' Look for right click.
If Button = vbRightButton Then
If ((Shift And vbCtrlMask) > 0) And _
((Shift And vbShiftMask) > 0) _
Then
' Ctrl-Shift click.
PopupMenu mnuCtrlShift
ElseIf (Shift And vbCtrlMask) > 0 Then
' Ctrl click.
PopupMenu mnuCtrl
ElseIf (Shift And vbShiftMask) > 0 Then
' Shift click.
PopupMenu mnuShift
Else
PopupMenu mnuRegular
End If
End If
End Sub
|
|
|
|
|
|