How to add existing forms to a RadDock?

12 posts, 0 answers
  1. John W Wilson
    John W Wilson avatar
    12 posts
    Member since:
    Mar 2009

    Posted 17 Jul 2009 Link to this post

    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?

  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 20 Jul 2009 Link to this post

    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.
  3. John W Wilson
    John W Wilson avatar
    12 posts
    Member since:
    Mar 2009

    Posted 22 Jul 2009 Link to this post

    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)!
  4. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 23 Jul 2009 Link to this post

    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.
  5. Patrick Gruhn
    Patrick Gruhn avatar
    1 posts
    Member since:
    Feb 2010

    Posted 02 Mar 2010 Link to this post

    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
  6. Nikolay
    Admin
    Nikolay avatar
    1805 posts

    Posted 05 Mar 2010 Link to this post

    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.
  7. R.H.B. Haukes
    R.H.B. Haukes avatar
    2 posts
    Member since:
    Apr 2010

    Posted 25 May 2010 Link to this post

    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
  8. Nikolay
    Admin
    Nikolay avatar
    1805 posts

    Posted 28 May 2010 Link to this post

    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.
  9. yudha
    yudha avatar
    2 posts
    Member since:
    Mar 2016

    Posted 26 Apr Link to this post

    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

  10. Hristo
    Admin
    Hristo avatar
    967 posts

    Posted 27 Apr Link to this post

    Hello yudha,

    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.
  11. yudha
    yudha avatar
    2 posts
    Member since:
    Mar 2016

    Posted 08 Jun in reply to Hristo Link to this post

    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();
            }

     

  12. Hristo
    Admin
    Hristo avatar
    967 posts

    Posted 09 Jun Link to this post

    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.
Back to Top