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.

Merge problem with ContextMenuItem in TabbedMdiManager

Thread ID:

Created:

Updated:

Platform:

Replies:

55046 Jan 23,2007 07:29 AM Jan 29,2007 03:16 AM Windows Forms 7
loading
Tags: Tools
Borja
Asked On January 23, 2007 07:29 AM

Hi, i'm using a TabbedMdiManager and im trying to replace the exixting contextmenu with one of my own. I'm using this code:

this._TabbedMDIManager.ContextMenuItem.MergeType = MenuMerge.Replace; this._TabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);

But it adds my items to the contextmenu instead of removing the existing ones and adding the new ones (i have also tried using MenuMerge.Remove and it works the same).

How can i do this?


Thank you in advance,
Borja

Golda Rebecal [Syncfusion]
Replied On January 24, 2007 08:15 AM

Hi Borja,

We can resolve this issue by first disposing the existing menu items in the ContextMenuItem of the TabbedMDIManager and then adding our own ContextMenuItem.

tb.ContextMenuItem.Items.Dispose();

tb.ContextMenuItem.MergeItems(contextMenuItem);

Please see the sample attached and let me know if this helps.

Thanks for your interest in Syncfusion products.

Regards,
Golda


tabbedmdi6.zip

Administrator [Syncfusion]
Replied On January 24, 2007 09:57 AM

Hi Golda,

Your solution works fine in your example, but there are a couple of wrong behaviors in my code (i have been able of reproducing it in the "browse samples" example of TabbedMdi that Syncfusion provides, so you can see in the attached file what is happening).

There are two things:

1.- When i have several tabs the context menu is the original one merged with the new one. If you close al the tabs but one the context menu is the new one.

2.- Even when there is only one tab the context menu contains the new bar items plus "Close" bar item.

I have compared the two examples (the one provided by syncfusion and the one you provide) but i can't tell what the difference is.


Thank you,
Borja

Administrator [Syncfusion]
Replied On January 24, 2007 09:59 AM

Here is the attachment :-S

TabbedMDIExample.zip

Murugan [Syncfusion]
Replied On January 24, 2007 02:14 PM

Hi Borja,

Thanks for your sample.

Could you please try the following code snippet
this.tabbedMDIManager.ContextMenuItem.BeforePopup += new CancelEventHandler(ContextMenuItem_BeforePopup);

private void ContextMenuItem_BeforePopup(object sender, CancelEventArgs e)
{

tabbedMDIManager.ContextMenuItem.Items.Clear();
this.tabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);

}

and let me know if it helps you.

Regards,
Murugan P.S

Administrator [Syncfusion]
Replied On January 25, 2007 03:12 AM

Hi Murugan,

Thanks for your code, but i'm sorre to tell that it neither worked in my code nor in the example from Syncfusion's browse samples.

Any other idea?

Borja

Golda Rebecal [Syncfusion]
Replied On January 25, 2007 04:18 AM

Hi Borja,

Could you please try the MergeItems method of the ParentBarItem to merge our menu after disposing the default items.

tabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);

I have modified the sample you have provided. Please see the attached sample and let me know if this helps.

Thanks,
Golda

tabtest.zip

Administrator [Syncfusion]
Replied On January 29, 2007 03:16 AM

Your solution works fine, thank you.

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.

;