Friday, 2 June 2017

How to dock a form to a panel programmatically

This is a quick solution to a question I had on how to have a form that is set so it can dock into another form's panel. I have a main form with a panel on the right with the 'Docksite' property set to true. I have another form with the 'DragKind' property set to dkDock and the 'DragMode' set to dmAutomatic. I create the docking form at runtime and wanted it so that by default it was docked into the right panel. The quick solution that I found hard to find on the net is after I create the form do the following:



  1. When I dock a form on a pagecontrol my MainMenu drop downs shift to upper screen left and not form upper left. Any suggestions?

    1. I've tried this and it seems to work OK, I am using Delphi Berlin 10.1. What version are you using, is the page control a standard page control and how is it positioned on the main form.