Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

Right click for options

What is the best way to create a list of options that appears when a user right clicks on a form - similar to when you right click on the the Windows Desktop?
0
newyorker
Asked:
newyorker
  • 4
  • 3
  • 3
  • +4
1 Solution
 
vzilkaCommented:
Try creating a menu using the menu-editor for the form.
Make the menu invisible, and use the "popup" function to display it in the "mouse_click" event.
good enough?
0
 
newyorkerAuthor Commented:
I would think that then my menu will be at the top of the form.  I am looking to create something similar to that right-clicking on the windows desktop, where the list of options is shown right beside the mouse.
0
 
chrisboltCommented:
Create a menu with the menu editor, make it invisible, and name it mnuPopup. Then add submenus to that menu and add this code to the MouseDown or MouseUp subroutine of the form:

If Button = 2 Then
  PopupMenu mnuPopup
End If

It will automatically pop up right beside the cursor.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
InteqamCommented:
i think the popupmenu has the options to specify the location to appear , so you can use the

Mouse_up event to determie th positions and the bottun clicked as follow.

private b as integer
private xx as integer
private yy as integer

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    b=burron
    xx=x
    yy=y
End Sub

and in the Form_click event do the followin .

Private Sub Form_Click()
    If b = 2 Then
       popupmenu mnupopup,, xx, yy
    Else
        If b = 1 Then
           
        End If
    End If
    b = 0
    xx = 0
    yy = 0
End Sub
0
 
covingtonCommented:
vzilka's answer is correct. The menu will pop up under the cursor automatically. The extra code is not needed.
0
 
InteqamCommented:
but how can you specify the location for the menu to appear into. the click event does not supply you with the coordination.
?

0
 
newyorkerAuthor Commented:
vzilka's answer was correct.  I thought it wasn't at first, but it was.  I am not sure about how to give vzilka the points.  If he answer's the question again I will give him the points.  Vzilka deserves the points.
0
 
InteqamCommented:
well thank you , but please explain your Q clearly again
and look good before rejecting an answer.

cause in my opinion ,when you rejected vzilka's answer i thought it is not completed.

No hard feelings vzilka.

0
 
watyCommented:
On the VBDiamond Web site (see my profile), you will find source code to create dynamically popup menu at runtime, at the place you want, and with bitmap. Let me know if you want also a copy by e-mail (waty.thierry@usa.net)
0
 
hakyemezCommented:
Use PopupMenu mnuYourMenu, vbPopupMenuRightButton

0
 
watyCommented:
Did you tried my solution?
0
 
newyorkerAuthor Commented:
Thanks.  Waty, thanks for your solution also.
0
 
watyCommented:
Wich solution do you use?
0
 
newyorkerAuthor Commented:
Vzilka's answer.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
  • 3
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now