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

load DocumentWindow in invisible mode

8 Answers 118 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 31 Oct 2014, 07:31 AM
how to load DocumentWindow in invisible mode?

I open the second and subsequent tabs:

Form privatForm= new Form();
privatForm.Dock = DockStyle.Fill;
privatForm.TopLevel = false;
 
DocumentWindow privatDockForm = new DocumentWindow();
privatDockForm.CloseAction = DockWindowCloseAction.Hide;
privatDockForm.Text = tabName;
privatDockForm.Controls.Add(privatForm);
generalFrm.radDock1.AddDocument(privatDockForm);
privatDockForm.Show();
privatForm.Show();

Not running the event PrivatForm_Load until the user activates it... How to force a load of my privatForm without displaying it to the user?
and how to add DocumentWindow in the Dock temporarily without creating a tab?

8 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 31 Oct 2014, 08:39 AM
Hi Ivan,

Thank you for writing.

I can see that you have found the CloseAction property of the DocumentWindow and you have set it to Hidden. This allows you to hide the form and show it when needed. Once you add it to RadDock, you can call the desired DocumentWindow's Close method, and this will hide it. Then, when you need to show it, you can call its Show method. 

More information about the object model of RadDock, can be found at the following help section: http://www.telerik.com/help/winforms/dock-object-model-creating-toolwindow-and-documentwindow-at-runtime.html.

I hope that the provided information addresses your question.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ivan
Top achievements
Rank 1
answered on 31 Oct 2014, 09:02 AM
Hi Stefan!
thank you for responding!
it didn't help... :(

I need to add DocumentWindow tab is not displayed.
In your way tab is displayed for a short time before use Close()

(I need to add DocumentWindow in the background immediately)
0
Ivan
Top achievements
Rank 1
answered on 31 Oct 2014, 09:38 AM
the video shows the bad effect of using
radDock1.AddDocument(privatDockForm);
privatDockForm.Close();

https://yadi.sk/d/IqPecYQNcQSBE
0
Stefan
Telerik team
answered on 31 Oct 2014, 11:19 AM
Hello Ivan,

If you call Close, the DocumentWindow tab will not be visible, as the window will be hidden (including its tab). I have just tested this on my end. See attached video (opens in browser).

Still, if you need to manipulate the DocumentWindow tab, here is how it can be accessed and hidden:
privatDockForm.TabStripItem.Visibility = ElementVisibility.Collapsed;

I hope this helps.

Regards,
Stefan
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ivan
Top achievements
Rank 1
answered on 31 Oct 2014, 12:24 PM
Dear Stefan.
Please try your example with the second and subsequent tabs. Before becoming invisible, the tab is visible a short time.
Attached 3 screenshots(step by step) from the debugger. On the first screenshot one tab before adding the second. In the second screenshot we can see that the tab is visible. On the third screenshot, it became invisible.
0
Dimitar
Telerik team
answered on 05 Nov 2014, 10:36 AM
Hello Ivan,

Thank you for writing back.

Better approach for this case will be to change the DockState property of the window after it is added:
Form privatForm = new Form();
privatForm.Dock = DockStyle.Fill;
privatForm.TopLevel = false;
 
DocumentWindow privatDockForm = new DocumentWindow();
privatDockForm.CloseAction = DockWindowCloseAction.Hide;
privatDockForm.DockState = DockState.Hidden;
privatDockForm.Text = "test";
privatDockForm.Controls.Add(privatForm);
this.radDock1.AddDocument(privatDockForm);
privatDockForm.DockState = DockState.Hidden;

Let me know how this works for you.

Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ivan
Top achievements
Rank 1
answered on 06 Nov 2014, 07:24 AM
Hello, Dimitar.
Thank you for wasting your time on me :)
In your example, too, have the appearance tab for a short time, and this causes the flashing effect. I found a solution for myself: adding privatDockForm, I add it first on another invisible dock. Maybe my solution is not very good, but my problem it solves. Thank you very much for your help!
1
Dimitar
Telerik team
answered on 07 Nov 2014, 04:17 PM
Hi Ivan,

Thank you for writing back.

Please note that if you have some heavy operations on the form's load you can consider to separate them in a different class so the form can be loaded faster. I am suggesting this because I cannot see any good reason to load a form that is not visible and how you will benefit from this. Perhaps if you can provide us with a detailed information about your exact case we will be able to provide you with a proper solution.

In addition I have recorded a small video where you can see that there is no flashing on my side.

Regards,
Dimitar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Dock
Asked by
Ivan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Ivan
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or