14 Answers, 1 is accepted
0
Hello Marc,
You can use the DockWindowClosing event to achieve this:
I hope this will be useful.
Regards,
Dimitar
Telerik by Progress
You can use the DockWindowClosing event to achieve this:
private
void
RadDock1_DockWindowClosing(
object
sender, Telerik.WinControls.UI.Docking.DockWindowCancelEventArgs e)
{
if
(e.NewWindow.Text ==
"documentWindow1"
)
{
e.Cancel =
true
;
e.NewWindow.DockState = Telerik.WinControls.UI.Docking.DockState.TabbedDocument;
}
}
I hope this will be useful.
Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
Veteran
answered on 02 May 2017, 12:24 PM
Hey Dimitar,
this is perfect! Thank you!
Is there any solution for redock at the same position as docked before?
Regards, Marc
0
Hello Marc,
An example for this is available here Set order to document windows - Dock - UI for WinForms Forum.
I hope this helps.
Regards,
Dimitar
Telerik by Progress
An example for this is available here Set order to document windows - Dock - UI for WinForms Forum.
I hope this helps.
Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Bruce
Top achievements
Rank 2
answered on 05 Jul 2017, 03:39 PM
[quote]Dimitar said:Hello Marc,
You can use the DockWindowClosing event to achieve this:
I hope this will be useful.
Regards,
Dimitar
Telerik by Progress
You can use the DockWindowClosing event to achieve this:
private
void
RadDock1_DockWindowClosing(
object
sender, Telerik.WinControls.UI.Docking.DockWindowCancelEventArgs e)
{
if
(e.NewWindow.Text ==
"documentWindow1"
)
{
e.Cancel =
true
;
e.NewWindow.DockState = Telerik.WinControls.UI.Docking.DockState.TabbedDocument;
}
}
I hope this will be useful.
Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
[/quote]
In the example above,when using auto MDI, the dock tab doesn't close, but the form inside is closed, leaving a blank tab, is there a method to prevent the form from closing also.
0
Hello Bruce,
The MDI child forms are explicitly closed in our code. In this case, you can use the Closing event of the child form:
I hope this will be useful.
Regards,
Dimitar
Progress Telerik
The MDI child forms are explicitly closed in our code. In this case, you can use the Closing event of the child form:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
var childForm =
new
RadForm2();
childForm.Text =
"MDI Child "
+ DateTime.Now.ToShortTimeString();
childForm.MdiParent =
this
;
childForm.FormClosing += ChildForm_FormClosing;
childForm.Show();
}
private
void
ChildForm_FormClosing(
object
sender, FormClosingEventArgs e)
{
e.Cancel =
true
;
var form = sender
as
RadForm2;
var host = form.Parent
as
HostWindow;
host.DockState = DockState.TabbedDocument;
}
I hope this will be useful.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Bruce
Top achievements
Rank 2
answered on 07 Jul 2017, 03:12 PM
Thank you for your Reply, this prevents the child form from closing in all circumstances, not just when someone attempts to close the tabbed document hosting it.
How would you in the closing event of the child form identify that the call to closed originated from the tabbed document, and not all instances?
How would you in the closing event of the child form identify that the call to closed originated from the tabbed document, and not all instances?
0
Hi Bruce,
You can check the DockState of the window:
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
You can check the DockState of the window:
private
void
ChildForm_FormClosing(
object
sender, FormClosingEventArgs e)
{
var form = sender
as
RadForm2;
var host = form.Parent
as
HostWindow;
if
(host.DockState == DockState.Floating)
{
host.DockState = DockState.TabbedDocument;
e.Cancel =
true
;
}
}
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Bruce
Top achievements
Rank 2
answered on 11 Jul 2017, 06:53 AM
This worked Great, Thanks Dimitar!
0
Marc
Top achievements
Rank 1
Veteran
answered on 23 Jan 2018, 07:50 AM
Hello Dimitar,
today I need your help again on this case.
I tried your linked solution, but it doesn't worked for me.
DEFINE VARIABLE iPosition AS INTEGER NO-UNDO.
DEFINE VARIABLE myDocWindow AS Telerik.WinControls.UI.Docking.DocumentWindow NO-UNDO.
DEFINE VARIABLE myTabStrip AS Telerik.WinControls.UI.Docking.DocumentTabStrip NO-UNDO.
myDocWindow = CAST(e:NewWindow, Telerik.WinControls.UI.Docking.DocumentWindow) NO-ERROR.
myTabStrip = CAST(e:NewWindow:DockTabStrip, Telerik.WinControls.UI.Docking.DocumentTabStrip) NO-ERROR.
IF myDocWindow <> ? AND myTabStrip <> ? THEN DO:
iPosition = myDocWindow:TabIndex.
e:Cancel = TRUE.
e:NewWindow:DockState = Telerik.WinControls.UI.Docking.DockState:TabbedDocument.
/* myTabStrip:Controls:SetChildIndex(e:NewWindow, iPosition). ???????????? */
END.
The TabIndex is correct, but where I have to set this?
0
Hi Mark,
You can use the DockStateChanged event because no windows are added in this case, and the strip is still not changed in the DockWindowClosing event handler. You can use a similar code:
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
You can use the DockStateChanged event because no windows are added in this case, and the strip is still not changed in the DockWindowClosing event handler. You can use a similar code:
private
void
RadDock1_DockStateChanged(
object
sender, DockWindowEventArgs e)
{
if
(e.DockWindow
is
DocumentWindow && e.DockWindow.DockState == DockState.TabbedDocument)
{
DockTabStrip strip = e.DockWindow.DockTabStrip;
if
(strip !=
null
)
{
strip.Controls.SetChildIndex(e.DockWindow,((DocumentWindow)e.DockWindow).TabIndex);
}
}
}
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
Veteran
answered on 23 Jan 2018, 10:15 AM
Hey Dimitar,
that's exactly what I'm looking for.
Thank you :-)
Kind regards
Marc
0
Marc
Top achievements
Rank 1
Veteran
answered on 23 Jan 2018, 10:56 AM
Ok, one more question ;)
If I use the regular way to dock the window again, it won't be worked.
0
Hi Marc,
Again the event is fired before the strip is changed. So to handle this case as well you need to use the TransactionCommitted event. Here is how you can rewrite the code in order to handle both cases:
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Again the event is fired before the strip is changed. So to handle this case as well you need to use the TransactionCommitted event. Here is how you can rewrite the code in order to handle both cases:
private
void
RadDock1_TransactionCommitted(
object
sender, RadDockTransactionEventArgs e)
{
if
(e.Transaction.TransactionType == DockTransactionType.DockWindow)
{
var window = e.Transaction.AssociatedWindows[0]
as
DocumentWindow;
if
(window == documentWindow1 || window == documentWindow2 || window == documentWindow3)
{
var strip = window.TabStrip;
if
(strip !=
null
)
{
strip.Controls.SetChildIndex(window, window.TabIndex);
}
}
}
}
Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
Veteran
answered on 24 Jan 2018, 09:48 AM
And another time, thank you, it works fine for me.