How to get the parent menu item of a menu item ? 
Author Message
 How to get the parent menu item of a menu item ?

Er, how about MenuItem::Parent ??

Nish

Quote:

> Hi, all

> I make the following codes in my project :

> ==================================================

>                // snip

> MenuItem miFile = mainMenu.MenuItems.Add("Favorite");
> miFile.MenuItems.Add(new MenuItem("add", new EventHandler
>                             (this.Add_Click), Shortcut.CtrlO));
> miFile.MenuItems.Add("-");
> miFile.MenuItems.Add(new MenuItem("delete", new EventHandler
>                              (this.Delete_Click), Shortcut.CtrlX));

>                // snip

> private void Add_Click(object sender, System.EventArgs e)
> {
>     // add a menu item to "Favorite"
>      MenuItem miAddClicked = (MenuItem)sender;

>              // snip
> }

> ======================================================================

> I want to add a menu item to "Favorite" dynamically at run time.
> For this, in "Add_Click", i think the parent menu item of "miAddClicked"

> How to get the parent menu ?

> Thank for your help.



Wed, 23 Feb 2005 00:16:00 GMT  
 How to get the parent menu item of a menu item ?
Hi, all

I make the following codes in my project :

==================================================

               // snip

MenuItem miFile = mainMenu.MenuItems.Add("Favorite");
miFile.MenuItems.Add(new MenuItem("add", new EventHandler
                            (this.Add_Click), Shortcut.CtrlO));
miFile.MenuItems.Add("-");  
miFile.MenuItems.Add(new MenuItem("delete", new EventHandler
                             (this.Delete_Click), Shortcut.CtrlX));

               // snip

private void Add_Click(object sender, System.EventArgs e)
{
        // add a menu item to "Favorite"
     MenuItem miAddClicked = (MenuItem)sender;

                     // snip            

Quote:
}

======================================================================

I want to add a menu item to "Favorite" dynamically at run time.
For this, in "Add_Click", i think the parent menu item of "miAddClicked"

How to get the parent menu ?

Thank for your help.



Tue, 22 Feb 2005 23:48:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Call parent forms menu item callback?

2. Trying to disable Menu Item and ToolbarCtrl item..

3. help working with context menus and adding menu items dynamically

4. Suspend menu item in the Start Menu

5. Adding a menu item to the explorers menus

6. Access keys for menu items in popup menus

7. how can I add myself menu item to default RichEdit system menu?(jchen)

8. how can I add myself menu item to CEdit right click menu?(jchen)

9. Adding a menu or context menu item in Internet Explorer

10. Adding a menu or context menu item in Internet Explorer with URL

11. Adding menu item to dialog menu

12. Cannot gray out menu item for a dialog menu

 

 
Powered by phpBB® Forum Software