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

Hide and show HostWindow

3 Answers 317 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Christoph
Top achievements
Rank 1
Christoph asked on 23 Oct 2018, 04:07 PM

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

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Oct 2018, 07:47 AM
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.
0
Christoph
Top achievements
Rank 1
answered on 24 Oct 2018, 08:37 AM

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

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Oct 2018, 10:48 AM
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.
Tags
Dock
Asked by
Christoph
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Christoph
Top achievements
Rank 1
Share this question
or