Sizing of ToolWindows

Docking/MDI for Windows Forms Forum

Posted 5 years ago by EntityDev
Version: 16.1.0330
Avatar

I create my ToolWindows from UserControl and initialize them programmatically, as below:

CustomersWindow = New CustomersWindow(DockManager, "CustomersWindow", "Customers", -1)
CustomersWindow.DockTo(DockManager, DockOperationType.LeftOuter)

 Does anyone know how to affect the size of the ToolWindow when it is initially docked? I tried, both before and after the .DockTo call:

CustomersWindow.Size = New System.Drawing.Size(200, 350)

 But it had no effect. Perhaps the better questions are how do I detail the splitter positions before the main form is shown? And, how is this managed when the main form is either maximized or minimized? And, what about minimum sizes?

Can LayoutData be persisted to app.config?

 

Edit:

While studying these issues it occurs to me that management of the ToolWindowContainers and/or DockContainerContainers may be a large part of a successful layout (when using UserControls).

If you have experience managing layouts and are willing to share some ideas, please feel free to do so.

[Modified 5 years ago]

Comments (4)

Posted 5 years ago by EntityDev
Avatar

I have found that when DocumentMDIStyle = Tabbed, then the inherent sizing/re-sizing behaves exactly as I would expect and would like to see. However, the applications I develop often do not contain "documents" in the strictest sense.

Instead, I host only ToolWindows in the MDI area, which of course is possible. But one must open the context menu and click "Dockable" in order to remove the ToolWindow from the MDI area and dock it in one of the other containers. My past projects were developed using a competitor's docking library, SandDock, but they're out of the game now and I have selected Actipro as its replacement.

It would be ideal if the user could simply drag the ToolWindow from the MDI area and dock them where desired.

Is this possible in the latest version? If not, I would like to request that it be implemented.

Because it doesn't appear to be possible in the version I have a license for, I have explored using DocumentMDIStyle.ToolWindowInnerFill, but the inherent resizing behavior is not desirable. The inclusion of an MDI area in the mix does behave as desired when resizing. But when using DocumentMDIStyle.Tabbed, the docking behavior is far from desirable.

Posted 5 years ago by EntityDev
Avatar

Ok, after a lot of trial and error, something like this seems to work well:

        Friend WithEvents CustomersWindow As CustomersWindow
        Friend WithEvents SafetyCouncilsWindow As SafetyCouncilsWindow

        CustomersWindow = New CustomersWindow(DockManager, "Customers", "Customers", -1)
        SafetyCouncilsWindow = New SafetyCouncilsWindow(DockManager, "SafetyCouncils", "Safety Councils", -1)

        'CustomersWindow
        CustomersWindow.DockedSize = New System.Drawing.Size(175, 191)
        CustomersWindow.DockTo(DockManager, DockOperationType.LeftOuter)

        'SafetyCouncilsWindow
        SafetyCouncilsWindow.DockedSize = New System.Drawing.Size(175, 100)
        SafetyCouncilsWindow.DockTo(CustomersWindow, DockOperationType.BottomOuter)
Answer - Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

When you call ToolWindow.DockTo(), it will attempt to use whatever size is set to the tool window's DockedSize property.  Thus you would want to set DockedSize prior to calling DockTo().

When we resize containers due to a splitter move, we update the dock container's DesiredContainerSize and then trigger a layout invalidation.  The layout updates the DesiredContainerSize to a resolved final layout size and then also runs through each tool window in the container and updates their DockedSizes to the current size.

If you have a MDI area, the layout logic tries to keep docked tool windows the same size as the main Form is resized and the MDI area will act like a filler, expanding/contracting as necessary.  If you use tool window inner-fill, then all the docked tool windows resize proportionally instead.

Layout data is just XML, so yes, you can persist it in any mechanism you want.

At the moment, tool windows can't be dragged out of the MDI area.  We have updated it to allow drag-to-float for the next build, which will help a bit.  Document windows already supported that.  The MDI area (including tool windows in MDI) and tool windows (outside of the MDI area) currently use two completely distinct code paths and logic areas for managing the docking behavior during drags, so it's not possible without major code changes to add tool window dock guide support from when a tool window is in the MDI area.


Actipro Software Support

Posted 5 years ago by EntityDev
Avatar

Thank you for the description of the behavior. Yes, I had already noted that ToolWindow and DocumentWindow, and their associated management, are two quite different animals. I thought I'd throw that request out there, though.

I think that when the DocumentWindow can be dragged to float in the next version, it will at least provide the user with some interaction when the tab is dragged. It is disconcerting now to grab a document tab, attempt to drag it and find that it won't move.

Although they won't be able to drag/dock it straight into a ToolWindowContainer, it will still be a very helpful step. They will at some point have gotten familiar with raising the context menu, I should think. Thank you for letting me know. I do like the product and plan to oontinue using it.

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.