How to add existing forms to a RadDock?

8 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. UI for WinForms is Visual Studio 2017 Ready
  4. 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)!
  5. 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.
  6. 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
  7. Nikolay
    Admin
    Nikolay avatar
    1803 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.
  8. 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
  9. Nikolay
    Admin
    Nikolay avatar
    1803 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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready