Missing FormClosing and FormClosed in RadDock

3 posts, 1 answers
  1. Bernd Mueller
    Bernd Mueller avatar
    38 posts
    Member since:
    May 2010

    Posted 22 Jul 2010 Link to this post

    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. Answer
    Nikolay
    Admin
    Nikolay avatar
    1804 posts

    Posted 28 Jul 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Bernd Mueller
    Bernd Mueller avatar
    38 posts
    Member since:
    May 2010

    Posted 28 Jul 2010 Link to this post

    Hello Nikolay,

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

    Best regards

    Bernd
Back to Top