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

No subject

Is there a built-in mechanism for the user to close a page/tab in the TabBarSplitterControl? If not, what would be the recommended approach? I'm thinking probably a custom context menu with a close option...

1 Reply

AD Administrator Syncfusion Team May 30, 2003 05:58 AM UTC

There is no built in UI to remove a tabpage in the TabSolitterBarControl. You could use context menus to do it as you suggested. To avoid interferring with the controls drag & drop tab positions code, I would suggest trying to display the context menu as follows to enable the context menu to appear when your user right clicks the tab itself. Do not try setting the ContextMenu property for the TabSplitterControl. Use the steps below instead. 1) Use teh designer to add the context menu in the component tray with your menu items and click handlers. But do not set it as the ContextMenu property for any control. 2) Hook the TabSplitterControlBar.MouseUp event to explicitly display the menu tabBarSplitterControl1.Bar.MouseUp += new MouseEventHandler(tabbar_MouseUp); 3) event code to display the menu
private void tabbar_MouseUp(object sender, MouseEventArgs e)
{
	if(e.Button == MouseButtons.Right)
		this.contextMenu1.Show(this.tabBarSplitterControl1.Bar, new Point(e.X, e.Y));
}
4)Have your delete menu selection handler use code like this. You should explicitly dispose of any grid controls (If you don't, the close button on your form won't work ????).
private void menuItem1_Click(object sender, System.EventArgs e)
{
	foreach(Control c in this.tabBarSplitterControl1.ActivePage.Controls)
	{
		if(c is GridControlBase)
			c.Dispose();
	}
this.tabBarSplitterControl1.TabBarPages.Remove(this.tabBarSplitterControl1.ActivePage);
}

Loader.
Live Chat Icon For mobile
Up arrow icon