TabbedMDIManager closing tabs using context menu.

How do I enable the context menu to be opened on a tab that is not currently in focus? I want to enable the user to close the tab without having to draw the screen. Currently when you right click on a tab that is not in focus, this bring the tab into focus. I do not want this to happen.

1 Reply

MJ Mano J Syncfusion Team October 21, 2009 10:32 AM UTC

Hi James,

You can prevent the tab getting selected by cancelling the selected index changing event when right click is made.

private void tabbedMDIManager_TabControlAdded(object sender, Syncfusion.Windows.Forms.Tools.TabbedMDITabControlEventArgs args)
{
tabControl = args.TabControl;
tabControl.SelectedIndexChanging += new SelectedIndexChangingEventHandler(tabControl_SelectedIndexChanging);
}

void tabControl_SelectedIndexChanging(object sender, SelectedIndexChangingEventArgs args)
{
args.Cancel = (Control.MouseButtons == MouseButtons.Right);
}

But it will close only the active tab, not the tab under the mouse.

Regards,
Mano

Loader.
Up arrow icon