Autohidden Toolwindows with WinForms ToolStrips can collapse if dialog opened (killing dialog too)

Docking/MDI for WPF Forum

Posted 7 years ago by Chien A.
Version: 17.2.0660
Platform: .NET 4.7
Environment: Windows 10 (64-bit)
Avatar

When an auto-hidden toolwindow contains a WinForms toolstrip via WindowsFormsHost, expanding the toolwindow via clicking on its tab, then interacting with the toolstrip only, will result in the toolwindow collapsing if a dialog is opened. This also results in the dialog being auto-closed as well.

I would guess that the same problem would also happen for MeuStrips in similar circumstances.

Some notes:

1) This only occurs if the toolwindow does not contain focus - if you click on a normal child control prior to opening dialog via toolstrip (e.g. in below example, a treenode) , then the toolwindow remains correctly expanded.

2) This only happens if the suggested DockSite.UseHostedPopups and DockSite.IsLiveSplittingEnabled are set to false. If this is not done, then the toolwindow remains expanded as it should be, although then you have the rendering problems that disabling those solve.

3) It doesn't matter whether the dialog opened is WinForms or WPF.

Below is code to reproduce the problem - add the Sub to MainControl of SimpleIDE Dock in the demo, and call at the end of construction.

Once run, click on the extra auto-hidden toolwindow's tab to expand, then click the only toolstripbutton on the toolstrip.

        Private Sub DockTest()
            Me.dockSite.UseHostedPopups = False
            Me.dockSite.IsLiveSplittingEnabled = False

            Dim f As New System.Windows.Forms.Form
            Dim tv As New System.Windows.Forms.TreeView
            Dim tn As New System.Windows.Forms.TreeNode("A Node")

            f.FormBorderStyle = Forms.FormBorderStyle.None
            tv.Location = New Drawing.Point(0, 25)
            tv.Nodes.Add(tn)
            tv.Dock = Forms.DockStyle.Fill
            f.Controls.Add(tv)

            Dim ts As New System.Windows.Forms.ToolStrip
            Dim tb As New System.Windows.Forms.ToolStripButton
            tb.Text = "A Button"
            tb.DisplayStyle = Forms.ToolStripItemDisplayStyle.Text

            ts.Items.Add(tb)
            ts.Dock = Forms.DockStyle.Top
            ts.Location = New Drawing.Point(0, 0)
            f.Controls.Add(ts)

            AddHandler tb.Click, Sub(ByVal sender As Object, ByVal e As EventArgs)
                                     System.Windows.Forms.MessageBox.Show("Hello")
                                 End Sub

            Dim wfh As New System.Windows.Forms.Integration.WindowsFormsHost
            Dim tw As New ToolWindow(dockSite, "1", "window1", Nothing, wfh)

            InteropFocusTracking.SetIsEnabled(wfh, True)
            f.Dock = Forms.DockStyle.Fill
            f.TopLevel = False
            wfh.Child = f

            tw.Activate()
            tw.Dock(tabbedMdiHost, ActiproSoftware.Windows.Controls.Side.Bottom)
            tw.AutoHide(ActiproSoftware.Windows.Controls.Side.Bottom)
        End Sub

Comments (2)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Chien,

I just tried this in the latest codebase by clicking the auto-hidden tab to show the auto-hide popup, then clicking the "A Button" button to show the dialog.  The dialog shows and nothing closes automatically.  It appears to be working ok for me.

Which version are you using?  Have you tried it with v2017.2 that recently came out?


Actipro Software Support

Posted 7 years ago by Chien A.
Avatar

Thanks for the response - this was with 2016.1 build 0636.

Looks like this has indeed been fixed somewhere between then and 2017.2, so you were one step ahead of us!

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.