Critical bug with document window tab sort

Docking/MDI for Windows Forms Forum

Posted 17 years ago by Sergei Kolemasov
Avatar
Product version: 2.0.92.0

1. Critical bug with document tab sort. Reproduction: when two or more document tabs opened, try to drag a tab to sort it, then press right mouse button on a document tab to show tab context menu. Exception is generated:

Message: ContextMenu cannot be shown on an invisible control.
Parameter name: control
Type: ArgumentException
Source: System.Windows.Forms
Stack: at System.Windows.Forms.ContextMenu.Show(Control control, Point pos, Int32 flags)
at System.Windows.Forms.ContextMenu.Show(Control control, Point pos)
at ActiproSoftware.UIStudio.Dock.DockManager.a(TabbedMdiWindow A_0, Rectangle A_1, TabbedMdiWindowContextMenuSource A_2)
at ActiproSoftware.UIStudio.Dock.TabbedMdiContainer.a(Object A_0, TabStripPageContextMenuEventArgs A_1)
at ActiproSoftware.UIStudio.TabStrip.TabStrip.OnTabStripPageTabContextMenu(TabStripPageContextMenuEventArgs e)
at ActiproSoftware.UIStudio.TabStrip.TabStrip.a(TabStripPageContextMenuEventArgs A_0)
at ActiproSoftware.UIStudio.TabStrip.TabStripTab.OnMouseUp(MouseEventArgs e)
at ActiproSoftware.WinUICore.UIElement.ActiproSoftware.WinUICore.IInputElement.RaiseMouseUpEvent(MouseEventArgs e)
at ActiproSoftware.WinUICore.UIControl.OnMouseUp(MouseEventArgs e)
at ActiproSoftware.UIStudio.TabStrip.TabStrip.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


2. Ability to drag a document tab to main area and drop it to create a new group has disappeared. (the new flag DockManager.TabbedMdiDragDropEnabled is true)

[Modified at 08/01/2007 08:01 AM]

Comments (8)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Are you positive that you are running the latest maintenance release? I've tried both of these numerous times but cannot reproduce either.

If you are sure you have the latest code then please give more detailed steps on how to reproduce them in the DockForm sample. Thanks!


Actipro Software Support

Posted 17 years ago by Sergei Kolemasov
Avatar
The assembly has 2.0.92.0 version. It seems to be the latest release. Everything worked properly with pervious versions. I'll think how to provide you with a sample.
Posted 17 years ago by Sergei Kolemasov
Avatar
Finnally, we have found the real cause of this bug and reproduced it with test app. I can send a sample project if you need.

In few words, incorrect behavior of DockManager starts after dynamic changing of DocumentWindow.Text property. Changing DocumentWindow.ToolBarText causes same issue. Everything works correctly if titles are static. Changing window title also makes impossible to use drag&drop for new window group creation.

Please review code snippet below. It assumes that there is a form with dockManager instance. OnLoad event creates 3 window containing web browser control. Then web browser control navigates to a web-site and changes window title to navigated url. When all titles are changed, you can drag window tabs to reproduce the bug.

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            WebBrowser b = new WebBrowser();
            b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
            DocumentWindow dw = new DocumentWindow(dockManager, "test 1",
                    "test 1", null, b);
            dw.Activate();
            b.Navigate("http://www.actiprosoftware.com/");

            b = new WebBrowser();
            b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
            dw = new DocumentWindow(dockManager, "test 2",
                    "test 2", null, b);
            dw.Activate();
            b.Navigate("http://www.actiprosoftware.com/");

            b = new WebBrowser();
            b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
            dw = new DocumentWindow(dockManager, "test 3",
                    "test 3", null, b);
            dw.Activate();
            b.Navigate("http://www.actiprosoftware.com/");
            
        }

        void b_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            DocumentWindow w = (DocumentWindow)((WebBrowser)sender).Parent;
            w.Text = e.Url.ToString();
        }
    }
Regards,
Sergei Kolemasov
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Sergei,

Quick question, did you get the latest maintenance release from a few days ago? I think this was fixed in that build.


Actipro Software Support

Posted 17 years ago by Sergei Kolemasov
Avatar
I missed the latest release info, so I've just got it and tested our app with the new version. Everything seems to be working correctly now.

Thanks!
Posted 16 years ago by Frank Preiss - Siemens AG
Avatar
I don't think that the issue is really fixed. We are using V2.0.93.0 and encounter unhandled exceptions in UIStudio when moving document windows with the mouse between different groups.

I have added the following lines to the DockForm.cs file of the sample app:

        /// <summary>
        /// Creates an instance of the <c>DockForm</c> class.
        /// </summary>
        public DockForm() {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Set the menu color scheme
            mainMenu.ColorScheme = WindowsColorScheme.VisualStudio2005;

            // Select the first item
            if (toolWindowPropertyGridComboBox.Items.Count > 0)
                toolWindowPropertyGridComboBox.SelectedIndex = 0;
            if (dockManagerPropertyGridComboBox.Items.Count > 0)
                dockManagerPropertyGridComboBox.SelectedIndex = 0;

            // Create documents
            this.CreateTextDocument(null, "This is a read-only document.  Notice the lock context image in the tab.", true).Activate();
            this.CreateTextDocument(null, null, false).Activate();

            string[] urlStrings = new string[] { "http://www.actiprosoftware.com/", "http://www.microsoft.com/", "http://www.codeproject.com/" };
            for (int i = 0; i < 3; i++)
                this.CreateWebBrowserDocument("Browser" + i, urlStrings[i]);

            // Set the size for screenshots
            // this.Size = new Size(408, 377);

        }

        private void CreateWebBrowserDocument(string name, string urlString)
        {
            WebBrowser b = new WebBrowser();
            b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
            DocumentWindow dw = new DocumentWindow(dockManager, name, name, null, b);
            dw.Activate();
            b.Navigate(urlString);
        }

        private void b_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            DocumentWindow w = (DocumentWindow)((WebBrowser)sender).Parent;
            w.Text = e.Url.ToString();
        }
I started the app from VS with F5, waited until all Webpages were loaded and then drag and dropped the document windows to new horizontal groups. Eventually an ArgumentOutOfRangeException occurs in the Dispose method. It is not 100% reproducible. Sometimes everything runs fine, but by dragging the documents around for a while the error occurs.

I our app I do have a scenario were I can reproduce the error every time.
Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Frank,

Please try out build 94 since there were some updates to the tabbed MDI in that and I haven't been able to generate an exception thus far with your code.


Actipro Software Support

Posted 16 years ago by Frank Preiss - Siemens AG
Avatar
Thanks for your reply. I tried build 94 and I can not reproduce the error in the sample app. I will now test the scenario with our app.
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.