Search code examples
delphidrag-and-drop

How do I make dockable forms like the IDE's without the very slow freezing movement of the dockable form?


How do I do the IDE method or eventually make the basic dock method without the very slow freezing movement of the dockable form?

When I Googled for dockable forms in Delphi and found a post by Zibadian on Programmers Heaven:

First off: The windows in the Delphi IDE aren't MDI forms, by SDI forms.

Now to create a dockable window.

Form2 will be dockable and Form1 will be the place to dock it to. Place a control (such as a TPanel) on Form1 to serve a DockSite. Make sure that you set the DockSite and the UseDockManager properties to true for that control.

For Form2 set the DragKind to dkDrop, the DragMode to dmAutomatic and UseDockManager to true.

That was the basic dock function. If you run your program, show the Form2 and drag that form over the docksite, it should dock at that site. You can even undock it by grabbing the "caption" as you have seen in the IDE.

For me, that method moves the dockable form very slowly. However, Zibadian's answer continues to describe how the IDE does it instead:

The dock-method of the IDE is a little more complex, since you don't see the docksite. I think, you need to write a Form1.OnDockOver or Form1.OnDockDrop to perform that. That (Those) event(s) need to show the docksite at the appropriate location.


Solution

  • Have a look at the Using the TDockTabSet component article by Jeremy North. It is a few years old but should give you some helpful pointers.