Need to create the equivalent of a MainMenu Popup event

  • Thread starter Thread starter Academia
  • Start date Start date
A

Academia

ContextMenu has a Popup event but MainMenu does not.

I need Popup with MainMenu.

Do you know anyway to simulate it?


Thanks in advance
 
Academia said:
ContextMenu has a Popup event but MainMenu does not.

I need Popup with MainMenu.

Do you know anyway to simulate it?

I have to ask you again why you want to use these old menus?

If you can use MenuStrip, there is MenuActivate event and then
DropDownOpening event for MenuItems.

-Teemu
 
I have a UserControl that has a ContextMenu, ContextMenu1, and a
GetContextMenu public function that returns ContextMenu1.

The form containing the UserControl uses GetContextMenu to get ContextMenu1
and merges it with it's MainMenu.


So your challenge is to do the same thing using the Strip elements!


Actually there is about 30 usercontrols and 50 forms so I'm not interested
in a completely new approach only in how to convert this approach to the
newer menus. Can you do it?

I doubt it because about a year ago I tried and also searched the internet
and only found others asking similar questions not getting answered.


Thanks for the interest
 
Academia said:
I have a UserControl that has a ContextMenu, ContextMenu1, and a
GetContextMenu public function that returns ContextMenu1.

The form containing the UserControl uses GetContextMenu to get
ContextMenu1 and merges it with it's MainMenu.


So your challenge is to do the same thing using the Strip elements!

OK, I can see your problem. One way to merge ContextMenuStrip to MenuStrip
is:

ToolStripMenuItem1.DropDown=ContextMenuStrip1

-Teemu
 
Let me give a little more details and if your solution still applies I'll be
very grateful.

The context menu contains main menu items: File, Edit, and View.
Each of these have menu items on them.

The main menu has main menu items: File and View.
These also have menu items on them.

Can I put one DropDown item someplace so I can merge the context menu with
the main menu so that the File and View items merge? That would be
equivalent to what I do now.


I would like to use the strips and if it has to be, I could make a context
menu for each of the main menu items: File, Edit, and View and have a
DropDown for each. Is that what I have to do?


Thanks for staying with me. I'd love to be able to use the newer menus!
 
Academia said:
Let me give a little more details and if your solution still applies I'll
be very grateful.

The context menu contains main menu items: File, Edit, and View.
Each of these have menu items on them.

The main menu has main menu items: File and View.
These also have menu items on them.

Can I put one DropDown item someplace so I can merge the context menu with
the main menu so that the File and View items merge? That would be
equivalent to what I do now.

If you need to merge menus like you described the operation is not so
simple. You can make menu item "Merge here" in the main menu and then easily
to merge all items to that item but merging to severeal points must be done
manually.

Is the context menu used as context menu or could it be converted to menu
strips? If that is possible then the merging process will be quite easy. You
could also create invisible menu strip in your user control and use that as
context menu also.

-Teemu
 
Teemu said:
If you need to merge menus like you described the operation is not so
simple. You can make menu item "Merge here" in the main menu and then
easily to merge all items to that item but merging to severeal points must
be done manually.

Is the context menu used as context menu or could it be converted to menu
strips? If that is possible then the merging process will be quite easy.
You could also create invisible menu strip in your user control and use
that as context menu also.

-Teemu

The context menu is used as the usercontrol's context menu.
And the same items appear on the form's main menu.

Seems you gave me a couple of options.
I believe you understand the problem and have much more insight than I have.

I don't need the way with the less effort.
I'd like the result to be the most straightforward code.

Can you recommend a method.

As I read what you wrote it seems like I can create an invisible menu strip
in the user control and use that for both the user control's context menu
and for the form's main menu. Is that correct?

Is that the method with the most straightforward code.

Thanks a lot
 
As I read what you wrote it seems like I can create an invisible menu
strip in the user control and use that for both the user control's context
menu and for the form's main menu. Is that correct?

Is that the method with the most straightforward code.

I think this could be the easiest solution. I tried this myself but I
encountered some strange problems. I noticed that some items were moved to
another menu not copied. Merging operation worked as I thought.

I'll look if I can make a nice solution.

-Teemu
 
I'll look if I can make a nice solution.

Unfortunately I have to admit that I can't get it work. If I could easily
make a clone from MenuStrip then my idea would work as I thought.

Now when I create a context menu from this menu strip, the items will be
removed from menu strip and so they cannot be merged to another menu strip.

What was the original purpose for this popup event? Maybe we can find
another way to implement it.


-Teemu
 
I really appreciate you trying.

I note also that no one else has indicated they know how.

I down loaded an example only to find he had duplicate memu items. That is,
he created both the menustrip and also put duplicates on the contextstrip.

Thanks again.
 
Back
Top