Hide and show HostWindow

4 posts, 0 answers
  1. Christoph
    Christoph avatar
    7 posts
    Member since:
    Jul 2016

    Posted 23 Oct 2018 Link to this post

    Hello,

    in our application we use the RadDock to show some tool windows. The orginal windows are WinForms forms and so we use the following statement to show it as toolwindow:

    Form f = new LogForm();
    hostWindow = radDockBase.DockControl(f, DockPosition.Right);
    hostWindow.DockState = DockState.Floating;
    hostWindow.CloseAction = DockWindowCloseAction.Hide;
    hostWindow.AllowedDockState = AllowedDockState.All ^ AllowedDockState.TabbedDocument;

    The window is displayed as expected (see BeforeClosing.png).

    For each tool window we add a menu item with which we can close and open the window with the following code:

    ...
    //hostWindow.DockState = DockState.Hidden;  <-- I've tried that too
    hostWindow.Close();
    ...
    ...
    hostWindow.Show();
    ...

    After showing the window again, the content of the window is no longer displayed (see AfterReShow.png).
    How can I re-show the window and display the content?
    Thanks for the help
    Christoph

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3900 posts

    Posted 24 Oct 2018 Link to this post

    Hello, Christoph, 

    Following the provided information, I was unable to reproduce the issue you are facing. Please refer to the attached gif file illustrating the behavior on my end with the specified version. I have attached my sample project. Feel free to modify it in a way to reproduce the experienced issue and get back to me with it so I can investigate the precise case. Thank you in advance. 

    I am looking forward to your reply.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Christoph
    Christoph avatar
    7 posts
    Member since:
    Jul 2016

    Posted 24 Oct 2018 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hello Dess,

    thanks for your example. In this case it will work. I have modify your example with the settings of my RadDock:

    public RadForm1()
    {
      InitializeComponent();
     
      this.radDock1.AutoDetectMdiChildren = true;
      this.radDock1.MdiChildrenDockType = DockType.Document;
      this.radDock1.DocumentManager.BoldActiveDocument = true;
      this.radDock1.SingleScreen = true;
      this.radDock1.DocumentTabsVisible = false;
      Form f = new LogForm();
      //Form f = new LogFormWinForms();
      hostWindow = this.radDock1.DockControl(f, DockPosition.Right);
      hostWindow.DockState = DockState.Floating;
      hostWindow.CloseAction = DockWindowCloseAction.Hide;
      hostWindow.AllowedDockState = AllowedDockState.All ^ AllowedDockState.TabbedDocument;
    }

    If i set AutoDetectMdiChildren to false it works, if i set it to true it does not work (in both cases: your LogForm as RadForm and my LogFormWinForms as WinForm).

    I have the modify the method to display the MDI children as a document:

    Form f = new MDIChildForm();
    HostWindow hostWindow = radDockBase.DockControl(f, DockPosition.Bottom);
    hostWindow.DockState = DockState.TabbedDocument;
    //f.MdiParent = this;  <-- I used this code before
    //f.Show();

    This workaround helps me to avoide AutoDetectMdiChildren.

    Thanks for your help

    Christoph

     

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3900 posts

    Posted 24 Oct 2018 Link to this post

    Hello, Christoph, 

    Indeed, in a MDI scenario the hosted form is cleared. This is because the form is closed and disposed and the Controls collection is cleared. However, the DockWindowCloseAction should be considered before closing the form.  I have logged it in our feedback portal for further investigation and check whether it could be properly handled in MDI. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

    I have also updated your Telerik points.

    Currently, the possible solution that I can suggest is  instead of using MDI, set the hostWindow.DockState property to DockState.TabbedDocument before showing the form.

    Should you have further questions please let me know.

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top