Solved

Right click for options

Posted on 1998-12-04
14
152 Views
Last Modified: 2012-05-04
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
Comment
Question by:newyorker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +4
14 Comments
 
LVL 9

Expert Comment

by:vzilka
ID: 1448272
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
 

Author Comment

by:newyorker
ID: 1448273
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
 
LVL 2

Expert Comment

by:chrisbolt
ID: 1448274
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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 7

Expert Comment

by:Inteqam
ID: 1448275
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
 
LVL 3

Expert Comment

by:covington
ID: 1448276
vzilka's answer is correct. The menu will pop up under the cursor automatically. The extra code is not needed.
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 1448277
but how can you specify the location for the menu to appear into. the click event does not supply you with the coordination.
?

0
 

Author Comment

by:newyorker
ID: 1448278
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
 
LVL 7

Expert Comment

by:Inteqam
ID: 1448279
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
 
LVL 14

Expert Comment

by:waty
ID: 1448280
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
 
LVL 3

Accepted Solution

by:
hakyemez earned 50 total points
ID: 1448281
Use PopupMenu mnuYourMenu, vbPopupMenuRightButton

0
 
LVL 14

Expert Comment

by:waty
ID: 1448282
Did you tried my solution?
0
 

Author Comment

by:newyorker
ID: 1448283
Thanks.  Waty, thanks for your solution also.
0
 
LVL 14

Expert Comment

by:waty
ID: 1448284
Wich solution do you use?
0
 

Author Comment

by:newyorker
ID: 1448285
Vzilka's answer.  
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Run code from text file in vb 1 101
Problem to With line 4 86
Excel VBA - Run Time error '1004' Application-defined or object-defined error 4 513
Automatic Email Reminder 4 94
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question