|
-
Dec 3rd, 1999, 05:04 AM
#1
Thread Starter
Addicted Member
Is it possible to make a menu popup within vb when you right-click of something. Same idea as when you rightclick the windows desktop, but just more customizable? if so is there a tutorial for this? can someone help me out? thanx!
-
Dec 3rd, 1999, 06:17 AM
#2
Sure. Add a menu to your form which has the top level (which I've called mnuFirstItem) enabled but not visible. Then add as many menu items under that one as you like, all of them being visible (don't worry they won't show up until you want them to). Then add code like this to your form and any object you want to have popup help.
Code:
Option Explicit
Private ControlClicked As Control
Private Sub MyObject_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
If Button = vbRightButton Then
Set ControlClicked = MyObject
PopupMenu mnuFirstItem
End If
Set ControlClicked = Nothing
End Sub
------------------
Marty
-
Dec 5th, 1999, 01:04 PM
#3
Member
Yes, it is possible to make a pop-up menu! In the Menu Editor, it should look like this one.
PopUp
...Blue
...Green
PopUp displays a pop-up Menu. When you right-click the mouse, pop-up menu appears.
Code:
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbrightButton Then
Call PopupMenu(mnuPopUp)
End If
End Sub
Private Sub mnuBlue_Click()
Label1.BackColor = vbBlue
End Sub
Private Sub mnuGreen_Click()
Label1.BackColor = vbGreen
End Sub
Hope this helps.
Ruchi
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|