We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Dynamically adding item to parent menu, from child.

Thread ID:

Created:

Updated:

Platform:

Replies:

9284 Dec 12,2003 07:26 AM Dec 12,2003 03:15 PM Windows Forms 3
loading
Tags: Tools
J Donnici
Asked On December 12, 2003 07:26 AM

In an MDI application, I''d like some code in a child form to dynamically add a menu item to an existing menu popup on the parent form''s menu. For a variety of reasons, I can''t use the childformbarmanager for this purpose, so I would like to do it programmatically (instead of relying on the merge capabilities). Once I get a reference to the parent form''s bar manager, I think I''m set, but I''m wondering if there''s an especially clean, efficient (or recommended?) way to get that reference from the parent form. Both forms are currently in the same project, but the child form doesn''t know anything about its parent form at design time, so this doesn''t work: this.mdiparent.mainformbarmanager I know I could modify the child form so that its constructor receives a reference to the bar manager, but this seems overly clumsy. In any case, I''m new to working with the XPMenus and the Essential Tools, so I''d be interested in hearing what others recommend for this type of need. Regards, JD

Administrator [Syncfusion]
Replied On December 12, 2003 08:38 AM

Hi JD, Here is a sample which demonstrates how menus in MDI Child forms can be dynamically added and merged. Check the Form2_Entered() and Form2_Left() sections of the code in Form2 including the comments for more details. Regards, Arun

J Donnici
Replied On December 12, 2003 09:27 AM

Hi Arun, Thanks for the example... I''m wondering if it''s possible to do this without the child form having its own ChildFrameBarManager. It wouldn''t be the end of the world if I need to use it, but I''d like the child form to be able to add to the parent menu directly without another child bar manager instance. Thanks again, JD >Hi JD, > >Here is a sample which demonstrates how menus in MDI Child forms can be dynamically added and merged. > >Check the Form2_Entered() and Form2_Left() sections of the code in Form2 including the comments for more details. > >Regards, >Arun >

Administrator [Syncfusion]
Replied On December 12, 2003 03:15 PM

Hi JD, The attached sample shows how menus and toolbars can be created in code within a UserControl, for example, and then exported to a Form''s menu-structure in which it will be hosted. Kindly take a look at the sample.txt file. Unlike our MDI-menu merging, where child menus appear/disappear as the child form becomes active/ inactive, this one is a one-time merge and export of the menu-structure from the UserControl to the Form. Regards, Arun

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;