_ ContextMenu questions

T

TryingLikeHeck

I have a usercontrol on which I've generated a context menu in designer.
The properties of the control lists for ContextMenu (none)
The menu shows up in the designer window and I can edit it

To assign my menu to the property in New I do
ContextMenu = RePopupMenu

To show it, on right mouse down I do
ContextMenu.Show(Me, New Drawing.Point(e.X, e.Y))

I also created some click event handlers

When running if I right mouse down I see the menu
But clicking an item does not cause the event to fire

Two questions
1) Any suggestions as to why the events are not firing

2) If I don't do ContextMenu = RePopupMenu
and on mousedows instead of doing
ContextMenu.Show(Me, New Drawing.Point(e.X, e.Y))
I do
RePopupMenu.Show(Me, New Drawing.Point(e.X, e.Y))
would that work? That is, what does assigning the property do?


Thanks in advance
(e-mail address removed)
 
O

One Handed Man [ OHM# ]

Hi TryingLikeHeck,

If you want the context menu to appear when you right click a main menu
option, set the mainmenu1.contextmenu to the name of your context menu in
the properties window for the MainMenu.

As for your handlers, we would need to see them. However, you may be falling
down the trap of using the MouseDown rather than MouseUp, take a look at
your code again and come back if you cant make it work and give us some code
to help us to assist you further.

Regards - OHM
 
T

TryingLikeHeck

You were exactly correct, I was using mousedown. I see now other contextmenus
appear on mouse up. So I changed that.

I want the context menu to appear when they rightclick on the control.
I don't understand the following.


"If you want the context menu to appear when you right click a main menu
option."

Well, maybe I do. Are you saying I could have one context menu when he clicks
the main menu and a different on fro clicking other places?

==========

I hate to include too much code because it makes the download long. But here
is a start. Never gets here. But in the IDE if I select mnuTopRuler and Click
it goes here so I'd guess that the definition is OK.

Public Sub mnuTopRuler_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles mnuTopRuler.Click

mnuTopRuler.Checked = Not mnuTopRuler.Checked
picTopRuler.Visible = mnuTopRuler.Checked
SetAllGuideTops()
End Sub



in usercontrol New I have
RichTextBox1.ContextMenu = RePopupMenu

I also have (which seems to work)
Private Sub RichTextControl_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
If e.Button = MouseButtons.Right Then RichTextBox1.ContextMenu.Show(Me,
New Drawing.Point(e.X, e.Y))
End Sub

Thanks for the help
(e-mail address removed)
 
O

One Handed Man [ OHM# ]

I'm sorry I have to go out now, please have a look at the online help and
let me know how you get on.

Regards - OHM
 
O

One Handed Man [ OHM# ]

Are you OK now with this or are you still having problems.?

Regards - OHM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top