|
-
Jul 30th, 2008, 02:04 PM
#1
Thread Starter
Lively Member
[RESOLVED] Right Click Menus
hey all. this has probably been answered already, but i couldn't find it. how can i add a right click menu to an object in my form? i.e. if the user right clicks a go button, it gives a menu saying "open in new window" "open in this window" etc.
Last edited by yomamathecableguy; Jul 30th, 2008 at 04:56 PM.
-
Jul 30th, 2008, 02:09 PM
#2
Addicted Member
Re: Right Click Menus
Use the mouse_down and up event. Both of them allow you test which mousebutton has been pressed. So set either the mouse_down or mouse_up on the button to check if the right button was pressed and then pop up the menu.
Simple little bugs 13 : Me 1
Law of Bugs - That one bug you missed will be found almost immediately, by your customer.
I wonder if anyone has ever asked for a User Surly interface?
-
Jul 30th, 2008, 02:13 PM
#3
Thread Starter
Lively Member
Re: Right Click Menus
could you provide an example code? i'm also not sure how to pop up the menu. i want it to look like the normal right click menus.
-
Jul 30th, 2008, 02:15 PM
#4
Hyperactive Member
Re: Right Click Menus
You would use the PopupMenu method. Yeah I know real hard right. Basically build your menu normally as you would build one in the menu editor, set it to Visible = False, then use Me.Popupmenu to pop it up (you will need to use the X and Y params to position it.
-
Jul 30th, 2008, 02:18 PM
#5
Addicted Member
Re: Right Click Menus
This is taken directly from help and assumes you have a menu already set up on your form.
Code:
Private Sub Form_MouseUp (Button As Integer, Shift As _
Integer, X As Single, Y As Single)
If Button = 2 Then ' Check if right mouse button
' was clicked.
PopupMenu mnuFile ' Display the File menu as a
' pop-up menu.
End If
End Sub
Simple little bugs 13 : Me 1
Law of Bugs - That one bug you missed will be found almost immediately, by your customer.
I wonder if anyone has ever asked for a User Surly interface?
-
Jul 30th, 2008, 02:18 PM
#6
Thread Starter
Lively Member
Re: Right Click Menus
ah i see. thank you so much! also, i know they're noob questions :P, but 1) how do i find the X and Y position of the mouse, and 2) how do i determine which mouse button was pressed?
-
Jul 30th, 2008, 02:19 PM
#7
Thread Starter
Lively Member
Re: Right Click Menus
now i know how to see which mouse button was pressed ^_^
-
Jul 30th, 2008, 02:20 PM
#8
Addicted Member
Re: Right Click Menus
There passed as integer values when the mouse_up event occurs.
Simple little bugs 13 : Me 1
Law of Bugs - That one bug you missed will be found almost immediately, by your customer.
I wonder if anyone has ever asked for a User Surly interface?
-
Jul 30th, 2008, 02:24 PM
#9
Thread Starter
Lively Member
Re: Right Click Menus
how would i access these?
-
Jul 30th, 2008, 02:26 PM
#10
Thread Starter
Lively Member
Re: Right Click Menus
OHHHHH nevermind. thank you everyone!! i got it now. big kudos to veritas and danecook
-
Jul 30th, 2008, 02:26 PM
#11
Addicted Member
Re: Right Click Menus
Their basic methods available to most controls. Easiest way would be to go to view code then select the control from the left drop down menu and then find "Mouse Up" from the right drop down menu.
If you would be so kind as to mark this as resolved?
Simple little bugs 13 : Me 1
Law of Bugs - That one bug you missed will be found almost immediately, by your customer.
I wonder if anyone has ever asked for a User Surly interface?
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
|