-
when I right-click on my form, a popup menu appears, but if I right-click again, the menu stays where it is, how do I get it to move to where I click?
P.S. - I tried:
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (Button = 2) Then
PopupMenu mnuEdit, , X, Y
End If
End Sub
-
<?>
Code:
'make a popup menu just like the one's in windows
'appear at the right click of your mouse as long
'as your right click is on the form
Option Explicit
Private Sub Form_Load()
mnuPop.Visible = False
End Sub
'
'allow users the ability of win keyboard menu key
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 93 Then
'fire up the popup menu
PopupMenu mnuPop, 2, 60, 60
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
'fire up the popup menu
PopupMenu mnuPop, 2, X, Y
End If
End Sub
-
Just to let you know, the constant for 2 here:
PopupMenu mnufile, 2, X, Y
is:
PopupMenu mnufile, vbPopupMenuRightButton, X, Y
some useless information, but may help in the future and help you to understand a bit more that you can use constants and not numbers.