CancelEventArgs e.Cancel doesn't work properly for DocumentPane

4 posts, 0 answers
  1. Jaroslav Bucek
    Jaroslav Bucek avatar
    9 posts
    Member since:
    Jul 2008

    Posted 09 Oct 2008 Link to this post

    Hi,

    when I Cancel closing of DocumentPane in Cancel event handler, it is canceled, but then it has "very interesting" behavior. When I click on another Tab of DockingManager, sometimes the DocumentPane stays in DockingManager and sometimes it disappears.

    Could you check it, please?

    2nd issue: how can I check if the closing was successful, when I call the Close method programatically? Could you change void Close method to it returns bool, if it was/was not closed?

    TIA
    Jaroslav Bucek
  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 13 Oct 2008 Link to this post

    Hello Jaroslav Bucek,

    1) We made some tests for this scenario, but did not find any problems. Please send us a simple example to reproduce the problem locally. Thank you in advance.

    2) To check the dockable window state, you can use the Visible or DockState == Hidden properties.

     
    All the best,
    Julian Benkov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Jaroslav Bucek
    Jaroslav Bucek avatar
    9 posts
    Member since:
    Jul 2008

    Posted 13 Oct 2008 Link to this post

     

    public partial class Form1 : Form

     

    {

     

        DockingManager mng;

     

     

        public Form1()

     

        {

            InitializeComponent();

            mng =

    new DockingManager();

     

            mng.Dock =

    DockStyle.Fill;

     

            mng.Parent =

    this;

     

     

            for (int i = 0; i < 5; i++)

     

            {

     

                DocumentPane doc = new DocumentPane();

     

                doc.Text =

    "Document" + i.ToString();

     

                doc.Closing +=

    new CancelEventHandler(doc_Closing);

     

                mng.SetDocument(doc);

            }

        }

     

        void doc_Closing(object sender, CancelEventArgs e)

     

        {

            e.Cancel =

    true;

     

        }

    }

    When you execute the code above and click on e.g. Document 4 tab using middle mouse button, then activate Document 3 by left mouse button click.

    Let me know.

  5. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 15 Oct 2008 Link to this post

    Hello Jaroslav Bucek,

    Thank you for the code and for reporting this issue. The fix will be available after upcoming Q3 release.

    Your Telerik points have been updated.

    All the best,
    Julian Benkov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top