By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,333 Members | 1,022 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,333 IT Pros & Developers. It's quick & easy.

_ ContextMenu questions

P: n/a
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
Tr************@REMOVEaol.com
Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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


TryingLikeHeck wrote:
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
Tr************@REMOVEaol.com


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #2

P: n/a
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
Tr************@REMOVEaol.com
Nov 20 '05 #3

P: n/a
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
TryingLikeHeck wrote:
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
Tr************@REMOVEaol.com


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #4

P: n/a

"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in message
news:eG**************@TK2MSFTNGP09.phx.gbl...
I'm sorry I have to go out now
Whenever you have time I'd be glad to hear from you


Nov 20 '05 #5

P: n/a
active, in connection with what ? ( Are you tryinglike heck ? )


active wrote:
"One Handed Man [ OHM# ]" <O_H_M{at}BTInternet{dot}com> wrote in
message news:eG**************@TK2MSFTNGP09.phx.gbl...
I'm sorry I have to go out now


Whenever you have time I'd be glad to hear from you


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #6

P: n/a

P: n/a
Are you OK now with this or are you still having problems.?

Regards - OHM

TryingLikeHeck wrote:
Sorry, yes
Tr************@REMOVEaol.com


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.