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

Get back a Closed Document

4 Answers 247 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ioannis
Top achievements
Rank 2
Ioannis asked on 25 Dec 2018, 11:15 PM

Hello,

 

So I have a form with a RadDock control which has a DocumentContainer which has a DocumentTabStrip on which I had created 4 DocumentsWindows

I wanted to do is so that the Main DocumentWindow (dwApplications) will have buttons that will make the other 3 DocumentWindows appear.

 

Now on the Form Designer I right-clicked and pushed "Close" on the 3 other DocumentWindows that I wanted to make them appear only if a button was pushed.
However, I fail to bring them back either on the Designer or in runtime.
On the designer I just can't see to find those document windows, not in the usual form designer nor in the Advanced Layout Designer

As for runtime, I thought that this would make them appear, but it actually doesn't

dwLoadEmployees.Show()
dwLoadEmployees.Select()

 

What can I do?

4 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 26 Dec 2018, 07:00 AM
Hello, Ioannis,
     
RadDock has two different methods (CloseWindow and RemoveWindow) which you can call if you want to remove a ToolWindow/DocumentWindow. The result from these methods depends on the CloseAction property which can have one of these values:
- Close: When a DockWindow has its CloseAction set to Close, this window is closed and detached (but not disposed) from its RadDock. You cannot manage it from RadDock collections anymore.
- Hide: When a DockWindow has its CloseAction set to Hide, this window is only closed (hidden) in RadDock. However, this window is not detached from its RadDock and you can manage it from the RadDock collections.
-CloseAndDispose: When a DockWindow has its CloseAction set to CloseAndDispose, this window is closed and then disposed.

Additional information is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/dock/object-model/removing-toolwindow-and-documentwindow-at-runtime

As to the question about closing the windows and restoring them at a later moment, note that when you close it at design time, the window is removed and you should add a new one when it is necessary.

It is recommended to manipulate the windows's visibility at run time by setting the CloseAction property to Hide for the desired DocumentWindow. Then, right click that window's tab and select Close. Then, call the Show method in order to bring back the window.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

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
Ioannis
Top achievements
Rank 2
answered on 26 Dec 2018, 10:09 AM

Hello Dess,

 

So, before closing them I had selected the "Hide" CloseAction property. I also can still see the DocumentWindows at the VS properties window (only it won't appear on the Designer).

So, now that I made the mistake of closing the DocumentWindow in Design time:

  1. Is there a way to bring them back to the Designer so I can drag'n'drop controls on them?
  2. How do I make them appear at runtime?
    • If there's no way to make them appear at runtime, is there a purpose for them still existing and being seen on the VS Properties window?

P.S. I have the history of every file on this project, so if the answer to "1)" is "no", then I could bring them back by restoring a previous version of a file. I am assuming the information for the DocumentWindows being part of the Dock is written on the form's Designer.vb file, but please tell me if the information is shared on other files as well so I restore everything before opening the project again.

 

0
Ioannis
Top achievements
Rank 2
answered on 26 Dec 2018, 12:11 PM

Yeah, turns out it was pretty straightforward to do it.

Just as I imagined, it was a one-liner on the form's Designer.vb

I just added:

Me.dtsDocuments.Controls.Add(Me.dwLoadEmployees)
Me.dtsDocuments.Controls.Add(Me.dwLoadHours)
Me.dtsDocuments.Controls.Add(Me.dwLoadSites)

and the 3 'missing' DocumentWindows returned on the Designer

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Dec 2018, 07:02 AM
Hello, Ioannis,

I am glad that you have a suitable solution for your case. I can suggest you an alternative solution which includes using the RadDock.AddDocument method passing the respective DocumentWindow that you want to show. Additional information for adding windows is available in the following help article: https://docs.telerik.com/devtools/winforms/controls/dock/object-model/creating-toolwindow-and-documentwindow-at-runtime

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

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
Ioannis
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Ioannis
Top achievements
Rank 2
Share this question
or