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

Connection between tab and the matching window

Hi,
When I put in the docking manager two or more windows (controls), I can get from each window to another by clicking on a tab that represent every window. So I want to know how can I get reference to the suitable window for every tab by the code ? Or in another words, how can I reach to the docked window object by it's "tabPageAdv" ?

thanks,
Yoni

7 Replies

AJ Ajish Syncfusion Team September 14, 2007 12:03 AM UTC

Hi Yoni,

Thank you for your interest in Syncfusion products.

Inorder to get the active docked tab you can make use of DockControlActivated event and get the current control that is active. Here is the code to get the name of the active tab control name,

private void dockingManager1_DockControlActivated(object sender, Syncfusion.Windows.Forms.Tools.DockActivationChangedEventArgs arg)
{

MessageBox.Show(arg.Control.Name);
}

Here is the sample for your reference,

Sample: http://websamples.syncfusion.com/samples/Tools.Windows/F68119/main.htm

Kindly let me if you need any further assistance.

Regards,
Ajish.


YO Yoni September 16, 2007 08:33 PM UTC

hi,
The solution you have wrote is not what I meant.
When I have the reference for a tab ("tabPageAdv") in the docking manager
(the tabs that in click on them I move between the docked controls)
I want to get from it reference to the docked control that the tab refers to.

The solution you have wrote helps me to get the ref to the docked control by event after I move to another tab, I don't want to get the ref by event but by the ref of the tab.

How can I do it ???

thanks,
Yoni


YO Yoni September 16, 2007 08:35 PM UTC

hi,
The solution you have wrote is not what I meant.
When I have the reference for a tab ("tabPageAdv") in the docking manager
(the tabs that in click on them I move between the docked controls)
I want to get from it reference to the docked control that the tab refers to.

The solution you have wrote helps me to get the ref to the docked control by event after I move to another tab, I don't want to get the ref by event but by the ref of the tab.

How can I do it ???

thanks,
Yoni


YO Yoni September 16, 2007 08:35 PM UTC

hi,
The solution you have wrote is not what I meant.
When I have the reference for a tab ("tabPageAdv") in the docking manager
(the tabs that in click on them I move between the docked controls)
I want to get from it reference to the docked control that the tab refers to.

The solution you have wrote helps me to get the ref to the docked control by event after I move to another tab, I don't want to get the ref by event but by the ref of the tab.

How can I do it ???

thanks,
Yoni


MS Mohamed Suhaib Fahad A. Syncfusion Team September 26, 2007 06:59 AM UTC

Hi Yoni,

Sorry for the inconvenience caused.

You can access the inner TabPages by using the following code,

[C#]

foreach (Control ctrl in this.dockingManager1.ControlsArray)
{

Syncfusion.Windows.Forms.Tools.DockHost dhost = ctrl.Parent as Syncfusion.Windows.Forms.Tools.DockHost;
if (dhost != null)
{
Syncfusion.Windows.Forms.Tools.DockHostController dhc = dhost.InternalController as
Syncfusion.Windows.Forms.Tools.DockHostController;

if (dhc.ParentController is Syncfusion.Windows.Forms.Tools.DockTabController)
{
Syncfusion.Windows.Forms.Tools.DockTabControl docktab = (dhc.ParentController as
Syncfusion.Windows.Forms.Tools.DockTabController).TabControl;

foreach (TabPageAdv page in docktab.TabPages)
{
MessageBox.Show(page.Name);
}
}
}
}
Please check out the sample from the following location,

http://websamples.syncfusion.com/samples/Tools.Windows/F68119_New/Main.htm

Let me know if you want any more details.

Thanks,
Fahad


YO Yoni October 6, 2007 06:02 PM UTC

Hey,
The solution you have wrote is not again what I meant.
The answer you wrote let me get a ref to the tabs by the docking control,
I have to know how to get the dockControl by the tab. (exactly the opposite of your solution)
I mean that if I have a "TabPageAdv" I want to know which control is the docked control that refers to the "TabPageAdv".


Thanks a lot,
Yoni


AD Administrator Syncfusion Team October 10, 2007 06:38 AM UTC

Hi Yoni,

You can get the dock control by tab by accessing through ChildControllers collection.

The following code snippet illustrates this.

[C#]

foreach (Control ctrl in this.dockingManager1.ControlsArray)
{
if (!alreadyProcessed)
{
Syncfusion.Windows.Forms.Tools.DockHost dhost = ctrl.Parent as Syncfusion.Windows.Forms.Tools.DockHost;
if (dhost != null)
{
Syncfusion.Windows.Forms.Tools.DockHostController dhc = dhost.InternalController as
Syncfusion.Windows.Forms.Tools.DockHostController;

if (dhc.ParentController.ChildControllers.Count>0)
{
alreadyProcessed = true;
foreach (DockHostController dock in dhc.ParentController.ChildControllers)
{
MessageBox.Show(dock.DockLabel.ToString());
}


}
}
}
else
break;
}


Please refer the sample that demonstrates the same and let me know if you have any other queries.

http://websamples.syncfusion.com/samples/Tools.Windows/F68119_Oct10/main.htm

Regards,
Jaya

Loader.
Live Chat Icon For mobile
Up arrow icon