This is a migrated thread and some comments may be shown as answers.

How to add existing forms to a RadDock?

11 Answers 909 Views
Dock
This is a migrated thread and some comments may be shown as answers.
John W Wilson
Top achievements
Rank 1
John W Wilson asked on 17 Jul 2009, 04:45 PM
I'm trying to convert for DockingManager to RadDock.

As the user adds new dynamically created Tab pages to a base page, we create a DockingManager dynamically on the tab.  Into this Docking manger, the user then drags pre-defined UserDockPanels or UserDockForms onto them.  We create the dockpanel or dockform by modifying a standard Windows form, for example by :
 
Partial Class CustomerForm 
  Inherits Telerik.WinControls.Docking.UserDockForm 
.... 
or
Partial Class ProductsPanel 
    Inherits Telerik.WinControls.Docking.UserDockControl 
..... 
These we can then dynamically add to the DockingManager when the user selects the option from a menu.  But I can find no equivalent way of pre-defining the DockWindows or DockPanels which can then be dynamically added to  the RadDock.

My idea for a solutuon was to dynamically create a DockWindow or DockPanel, then add the pre-defined panels (now redefined as RadForms) into the  DockWindow or Dockpanel.   

Your code sample suggests I can create DockWindows with this code
            Dim docWindow As DockWindow = New DockWindow() 
 
gives the warning: 
The designer must create an instance of type 'Telerik.WinControls.UI.Docking.DockWindow' but it cannot because the type is declared as abstract. 
 

If I ignore the warning (which I don't want to do) , I can find no way of adding a standard windows or radform into the contents of this DockWindow.  Have I missed the plot entirely?  How do I (Can I?) add an existing form by code into a Docking Window or Docking Panel?  Or should I continue using the Docking Manager?

11 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 20 Jul 2009, 08:50 AM
Hello John W Wilson,

This behavior is simplified in the new RadDock component. To add a Control or a Form objects you can use the DockControl method of RadDock manager:

Form myForm = new Form(); 
HostWindow hostWindow = radDock1.DockControl(myForm, (DockWindow)null, DockPosition.Left);  //for Q2 2009 SP1 release can use also 'radDock1.DockControl(myForm, DockPosition.Left)' 
radDock1.FloatWindow(hostWindow); 
myForm.Show();      //this will be not needed for Q2 2009 SP1 release 
 
if (hostWindow.FloatingParent != null
    hostWindow.FloatingParent.AcceptButton = ((Form)hostWindow.Content).AcceptButton; 
    hostWindow.FloatingParent.CancelButton = ((Form)hostWindow.Content).CancelButton; 
}  

We will add more improvements in Q2 2009 SP1 to make the process even more flexible.

All the best,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
John W Wilson
Top achievements
Rank 1
answered on 22 Jul 2009, 06:34 PM
I don't have a problem with this for Windows forms, but how do you add a RadForm?  It does seem illogical that you don't provide facilities for using your new shiny and improved RadForms (relative to Windows Forms)!
0
Julian Benkov
Telerik team
answered on 23 Jul 2009, 09:31 AM
Hi John W Wilson,

You can add also RadForm objects to RadDock using the same API. In Q2 2009 release when the RadForm is added to a RadDock the title bar is visible. In the upcoming Q2 2009 SP1 release, the issue is fixed.

You can use the following workaround to hide the title bar of your RadForm:

RadForm myForm = new RadForm(); 
myForm.FormBorderStyle = FormBorderStyle.None; 
 
HostWindow hostWindow = radDock1.DockControl(myForm, (DockWindow)null, DockPosition.Left);  //for Q2 2009 SP1 release can use also 'radDock1.DockControl(myForm, DockPosition.Left)'  

Kind regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Patrick Gruhn
Top achievements
Rank 1
answered on 02 Mar 2010, 02:08 PM
Hello,

i am using the following Code to add dynamic tabs to a documentTabStrip (with one DocumentWindow that ist generatet by the design-time-interface):

Control myControl = new CCC.CustomerForm(); 
myControl.Dock = DockStyle.Fill; 
RadForm myForm = new RadForm(); 
myForm.Controls.Add(myControl); 
myForm.Text = "CCC | Edit Customer"
radDock1.DockControl(myForm, documentTabStrip2, DockPosition.Fill); 

The problem is that if the design-time generated DocumentWindow is closed I get a "Changing Children collection of an already disposed element" Exection. How can I prevent this?

Regards
Patrick
0
Nikolay
Telerik team
answered on 05 Mar 2010, 02:18 PM
Hello Patrick Gruhn,

Thank you for the question.

When you remove a DocumentWindow from RadDock, its DocumentTabStrip is disposed if there are no other DocumentWindows in the same DocumentTabStrip. This is done for optimization purposes. So, in order to dock your form, please either use a valid DocumentTabStrip, or dock it directly in RadDock:
RadForm myForm = new RadForm();
myForm.Text = "CCC | Edit Customer";
radDock1.DockControl(myForm, DockPosition.Left);

If you have additional questions, feel free to contact me.

Regards,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
R.H.B. Haukes
Top achievements
Rank 1
answered on 25 May 2010, 09:27 AM
Hi there,

I'm pretty new with Telerik and have a question. I have a RadDock1 on a form. On that form there is also a button. Every time the users clicks this button I want to create a new tab on RadDock1 filled (maximized) with a (win)Form (named "frmProject").
I've created a sub "AddPage":
    Private Sub RadButtonElement1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles RadButtonElement1.Click  
        AddPage(frmProject, "Project")  
    End Sub 
 
 
    Private Sub AddPage(ByVal f As Form, ByVal strPage As String)  
 
        RadDock1.DockControl(f, DockPosition.Fill, DockType.Document)  
 
    End Sub 

The first time the user clicks the button a new tab is added with the form filled on it. But the second time the user clicks the button only a tab is added. I can't see the form.

Can you please tell me what I am doing wrong?

Kind regards,
Ronald
0
Nikolay
Telerik team
answered on 28 May 2010, 02:05 PM
Hello Roland,

Please find the answer to your question in the following forum thread:
http://www.telerik.com/community/forums/winforms/dock/open-several-winforms-on-dock.aspx

Sincerely yours,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
yudha
Top achievements
Rank 1
answered on 26 Apr 2017, 09:29 AM

Hello,

I am trying to add form to radDockWindows but the result is the form not load or running smoothly.

Gridview not showing properly, and combobox "pilih toko" not change immediately after choosed the item.

 

private void radButtonHistory_Click(object sender, EventArgs e)
        {
            AddNewTab("ShopHistoryTransaction", ref DockWindow);
            if (tabDuplicate != true)
            {
                AddExistingFormStoreHistoryTransaction();
            }
        }
  
void AddNewTab(string TabName, ref Telerik.WinControls.UI.Docking.DocumentWindow iDocWindow)
        {
            tabDuplicate = false;
            foreach (Telerik.WinControls.UI.Docking.DockWindow dw in radDock1.DockWindows.DocumentWindows)
            {
                if (dw.Name == TabName)
                {
                    if (dw.DockState == Telerik.WinControls.UI.Docking.DockState.Hidden)
                    {
                        dw.CloseAction = Telerik.WinControls.UI.Docking.DockWindowCloseAction.CloseAndDispose;
                    }
                    else
                    {
                        dw.Show();
                        dw.Select();
                        tabDuplicate = true;
                    }
                }
            }
  
            if (tabDuplicate == false)
            {
                iDocWindow = new Telerik.WinControls.UI.Docking.DocumentWindow(TabName);
                iDocWindow.Name = TabName;
                iDocWindow.CloseAction = Telerik.WinControls.UI.Docking.DockWindowCloseAction.CloseAndDispose;
                radDock1.DocumentManager.DocumentInsertOrder = Telerik.WinControls.UI.Docking.DockWindowInsertOrder.ToBack;
                this.radDock1.AddDocument(iDocWindow);
  
                setButtonVisibtily(Telerik.WinControls.ElementVisibility.Collapsed, Telerik.WinControls.ElementVisibility.Collapsed, Telerik.WinControls.ElementVisibility.Collapsed, Telerik.WinControls.ElementVisibility.Collapsed, Telerik.WinControls.ElementVisibility.Collapsed, Telerik.WinControls.ElementVisibility.Visible);
                SetButton(false, false, false, false, false, true);
            }
        }
  
void AddExistingFormStoreHistoryCommunication()
        {
            RadFormHistoryTransaction ShopHistoryTrx = new RadFormHistoryTransaction();
            ShopHistoryTrx.TopLevel = false;
            ShopHistoryTrx.Dock = DockStyle.Fill;
            ShopHistoryTrx.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            ShopHistoryTrx.Show();
  
            DockWindow.Controls.Add(ShopHistoryTrx);
        }

 

Please remove .gif extension and extract with KGB software

0
Hristo
Telerik team
answered on 27 Apr 2017, 12:26 PM
Hello ,

Thank you for writing.

You can refer to the following section of our documentation: Docking User Controls and Forms

Please also bear in mind that if you would like to send us your project you should open a support ticket. This can be done straight from your Telerik account.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
yudha
Top achievements
Rank 1
answered on 08 Jun 2017, 07:15 AM

Hai Hristo,

Thank you for the replay, its help me.

 

Now I have another problem.

I Have radFormTransaction, and I have gridview for the detail product.

How to call radFormTransactionDetail to radDockWindows and loaded into radFormMain when I do double click on gridview?

//this is syntax in the formMain
public void TransactionDetail()
        {
            AddNewTab("RadFormLoadInvoice1", ref DockWindow);
            if (tabDuplicate != true)
            {
                AddExistingFormStoreHistoryTransactionDetail();
            }
        }
 
public void AddNewTab(string TabName, ref Telerik.WinControls.UI.Docking.DocumentWindow iDocWindow)
        {
            tabDuplicate = false;
            foreach (Telerik.WinControls.UI.Docking.DockWindow dw in radDock1.DockWindows.DocumentWindows)
            {
                if (dw.Name.Contains(TabName) == true)
                {
                    if (dw.DockState == Telerik.WinControls.UI.Docking.DockState.Hidden)
                    {
                        dw.CloseAction = Telerik.WinControls.UI.Docking.DockWindowCloseAction.CloseAndDispose;
                    }
                    else
                    {
                        dw.Show();
                        dw.Select();
                        tabDuplicate = true;
                    }
                }
            }
 
            if (tabDuplicate == false)
            {
                iDocWindow = new Telerik.WinControls.UI.Docking.DocumentWindow(TabName);
                iDocWindow.Name = TabName;
                iDocWindow.CloseAction = Telerik.WinControls.UI.Docking.DockWindowCloseAction.CloseAndDispose;
                radDock1.DocumentManager.DocumentInsertOrder = Telerik.WinControls.UI.Docking.DockWindowInsertOrder.ToBack;
            }
        }
 
        public void AddExistingFormStoreHistoryTransactionDetail()
        {
            ShopHistoryTrxDetail = new RadFormLoadInvoice();
            ShopHistoryTrxDetail.TopLevel = false;
            ShopHistoryTrxDetail.Dock = DockStyle.Fill;
            ShopHistoryTrxDetail.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            ShopHistoryTrxDetail.Name = "RadFormLoadInvoice";
            ShopHistoryTrxDetail.Text = "Transaksi Detail";
 
            radDock1.DockControl(ShopHistoryTrxDetail, Telerik.WinControls.UI.Docking.DockPosition.Fill, Telerik.WinControls.UI.Docking.DockType.Document);
            ShopHistoryTrxDetail.Show();
            Properties.Settings.Default.ActiveForm = ShopHistoryTrxDetail.Name;
        }
 
//this is syntax in the RadFormLoadInvoice
private void radGridViewStoreHistoryTransaction_DoubleClick(object sender, EventArgs e)
        {
            RadFormMain frmMain = new RadFormMain();
            frmMain.TransactionDetail();
        }

 

0
Hristo
Telerik team
answered on 09 Jun 2017, 11:57 AM
Hello Yudha,

I am not quite sure that I completely understand your current setup.

Can you please open a support ticket and send us your project so that we can test it locally.

Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Dock
Asked by
John W Wilson
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
John W Wilson
Top achievements
Rank 1
Patrick Gruhn
Top achievements
Rank 1
Nikolay
Telerik team
R.H.B. Haukes
Top achievements
Rank 1
yudha
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or