This is a migrated thread and some comments may be shown as answers.
Missing FormClosing and FormClosed in RadDock
2 Answers 97 Views
This is a migrated thread and some comments may be shown as answers.
Bernd Mueller
Top achievements
Rank 1
Bernd Mueller asked on 22 Jul 2010, 04:46 PM
Hi,

a RadForm assigned to the RadDock is not sending the FormClosing or FormClosed event when i close the tab.
RadDock1.DockControl(form, UI.Docking.DockPosition.Fill, UI.Docking.DockType.Document)

Sometimes a have a lengthy operation and it is still running in the background when i already have closed the tab. Is there a good way to see from within the form if it was closed from outside? There is this TransactionCommitted event that gives me a RemovedWindow list when tabs are closed, but i don't know how to get back to the form itself. Is there a specific reason why the close events are not fired?

Thank you!

Bernd

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 28 Jul 2010, 11:48 AM
Hi Bernd Mueller,

When you dock a Form in RadDock as a control, RadDock becomes responsible for the closing operations, so we do not call the closing/closed events of the form explicitly.

However, because of MDI specifics, we do allow our users to handle the FormClosing/FormClosed events of the MDI children docked in RadDock. Since your scenario concerns docking forms in RadDock as documents, I would suggest that you use MDI for your forms.

In case you do not actually need MDI or forms, you can simply put your controls in a user control which I think is the more appropriate component for your scenario.

As to the TransactionCommitted event, you can get the form as shown below:
void radDock1_TransactionCommitted(object sender, Telerik.WinControls.UI.Docking.RadDockTransactionEventArgs e)
{
    if (e.Transaction.TransactionType == DockTransactionType.Close)
    {
        HostWindow hostWin = e.Transaction.RemovedWindows[0] as HostWindow;
        if (hostWin != null)
        {
            Form f = hostWin.Content as Form;
            if (f != null)
            {
                // do sth here
            }
        }
    }
}

I hope this helps.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Bernd Mueller
Top achievements
Rank 1
answered on 28 Jul 2010, 12:06 PM
Hello Nikolay,

thanks for the great help. That was exactly what i was looking for.

Best regards

Bernd
Tags
Dock
Asked by
Bernd Mueller
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Bernd Mueller
Top achievements
Rank 1
Share this question
or