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. Image for the cookie policy date
close icon

Problem with the dynamic menu construction in MDI child form.

I think the problem will be best illustrated with the example. I have an MDI application. In its child form, part of the "View" menu is constructed in the following way: foreach (Viewer v in ViewerPlugins) { BarItem bi = new BarItem(v.Name, new EventHandler(addViewer_Click)); childFrameBarManager.Items.Add(bi); // pbi stands for "parentBarItem" pbiView.Items.Insert(pbiView.Items.IndexOf(biViewAddForm), bi); } Everything worked like a charm until we decided to add the "View" menu to the main form. After that, the dynamically constructed part disappeared from the menu for the obvious reason - the merged menu must have used the ParentBarItem "View" from the main form''s menu. My question is simple - is it possible to get it back without losing the luxury of automatic menu merging? Thanks! Andrew.

4 Replies

AD Administrator Syncfusion Team April 26, 2004 03:33 PM UTC

Hi Andrew, I have created a sample application as per my understanding of your specifications above. Please refer to the sample and let me know if I have understood your problem correctly. If not, kindly modify the sample to show the problem that you are facing and send it back to us so that we could further investigate this issue. We appreciate your cooperation, and thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AS Andrew Skalkin April 26, 2004 08:07 PM UTC

Hi Guru, >I have created a sample application as per my understanding of your specifications above. This sample application doesn''t have a merged menu. Attached is the modified example (I added the "Common View" category that exists in both main and child forms). Thanks! mdi_menus_7424.zip


AD Administrator Syncfusion Team April 28, 2004 11:18 AM UTC

Hi Andrew, Thanks for the modified sample. I could see the above mentioned problem here. Once the menu merging occurs, BarItems cannot be added dynamically through the MainFrameBarManager or ChildFrameBarManager. I have consulted the development team in this regard, and will update as soon as I hear from them. We appreciate your patience, and thanks for choosing Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.


AD Administrator Syncfusion Team April 28, 2004 11:53 AM UTC

Hi Andrew, After having further investigated this issue, I would like to inform you that you would have to get hold of the merged ParentBarItem of the parent-child menus by invoking the GetMergedEquivalent method, and then dynamically add the BarItems to that one. Often in a MDI scenario, ParentBarItems created during design-time in the MDI Parent and MDI children are merged together (if satisfying the merge criteria) into a new ParentBarItem which will replace the original in the menu structure. Once replaced, changes made to the original ParentBarItem, like adding a new BarItem will not be reflected in the merged one. So, you should access the merged item directly to add child BarItems. The newly added BarItems will then stay until the merging is lost (could happen when a different child form gets activated, etc). So, the recommended way is to keep all the required BarItems in the mainform''s ParentBarItem right from the beginning, before the merge, and show/hide them as necessary (instead of adding/removing them). I have also modified your previous sample accordingly and have attached_it_here. Please refer to it and let me know if you need any other information. We appreciate your continued interest in Syncfusion products. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon