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

Changing dock tabs programatically

Hi If you have a couple of controls docked together so that the form a tab group docked to the side of a form (using a docking manager)- is it possible to programatically change tabs? i.e - I want to bring a docked control "to the front" if it is covered by other docked controls. Thanks

3 Replies

PS Prakash S Syncfusion Team May 22, 2002 10:32 AM

Paul, The Docking Windows implementation does not have a direct way for programmatically changing the selection in a tabbed docking group. However, you can do this by directly accessing the internal docking windows classes and changing the selected tab. The following code shows the approach,
// To activate the docking window tab representing the treeView1 control
	Syncfusion.Windows.Forms.Tools.DockHost dhost = this.treeView1.Parent as Syncfusion.Windows.Forms.Tools.DockHost;
	Syncfusion.Windows.Forms.Tools.DockHostController dhc = dhost.InternalController as Syncfusion.Windows.Forms.Tools.DockHostController;
	// Verify that the control is docked as a tab group
	if((dhc.ParentController != null) && (dhc.ParentController is Syncfusion.Windows.Forms.Tools.DockTabController))
{				Syncfusion.Windows.Forms.Tools.DockTabController dtc = dhc.ParentController as Syncfusion.Windows.Forms.Tools.DockTabController;
	Syncfusion.Windows.Forms.Tools.DockTabControl tabcontrol = dtc.TabControl as Syncfusion.Windows.Forms.Tools.DockTabControl;
	Syncfusion.Windows.Forms.Tools.DockTabPage activetab = tabcontrol.SelectedTab as Syncfusion.Windows.Forms.Tools.DockTabPage;
	// Verify that the control is not the selected tab
	if(activetab.dhcClient != dhc)
	{
	    // Iterate tabpages and activate the treeview tab
	    foreach(Syncfusion.Windows.Forms.Tools.DockTabPage page in tabcontrol.TabPages)
	    {
		if(page.dhcClient == dhc)
		{
		    tabcontrol.SelectedTab = page;
		    break;
		}
	    }
	}
}
Prakash Syncfusion, Inc.


DW David Whatley May 1, 2003 12:39 PM

Is this still the only way to do this? -- David


PS Prakash S Syncfusion Team May 1, 2003 03:59 PM

Hi David, Starting with v 1.1.0.0 of Essential Tools, the DockingManager has an ActivateControl(Control) method that can be used for this purpose. For more details please refer to the Class Reference documentation on this method. Prakash Syncfusion

Loader.
Live Chat Icon For mobile
Up arrow icon