Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Docking info about dynamically created panels/forms

In an application where forms/frames are created dynamicaly and added in TLMDDockingPanels, how do you integrate the saving/loading of panel layout?
I would like to register a class/instance information pair on every panel, so I can recreate an identical set, when restarting the app.

Is there a solution for this ?

in the XML file there is a <zone kind="PANEL" id="frmMain.pnlCalendar"...> entry per panel. Can I customize the id attribute?


  • 4 Comments sorted by Votes Date Added
  • Posts: 0 Accepted Answer Vote Up0Vote Down

    You can customize Id attribute. Use dock-manager's OnGetComp/OnGetCompId event handlers. AComponent parameter of OnGetCompId event is a saving docking-panel; if you want to provide another Id for it, you can change AId parameter value. OnGetComp event is fired while loading layout; here you need to provide a reference of your component given it (customized) Id. This can be a reference to existing dock-panel or it can be a panel, created on the fly.

    Additionally, you can store additional application related data inside the layout using OnWriteAppInfo/OnReadAppInfo event handlers.

  • Posts: 0 Accepted Answer Vote Up0Vote Down
    Some more notes about OnGetComp/OnGetCompId events:

    AComponent parameter in these events is of TComponent type. Why its not a TLMDDockPanel? This is because our docking solution is compatible with VCL docking, and, thus, any control can be docked into the site, not only dock-panels.

    Generally, its not recommended to go this way, however its possible. 

    Usually, when you create dock-panels at design-time, or dock dynamically created panels at run-time - they become "dock clients" of the site. Dock clients can be iterated using standard TControl.DockClients\DockClientCount collection.
    However, if you'll dock into the site another control (for example, TMemo) manually, using standard Delphi docking methods, this memo itself will be considered as a dock client; and will be visible in DockClients collection. This memo will be wrapped with an internally created dock-panel, but this panel itself will not be considered as docked, and will not be presented in DockClients collection.
    So, in this case, AComponent parameter value of  OnGetComp/OnGetCompId event will point to the memo itself, not to corresponding internal dock-panel.

    Actually, all this is done just like in standard TPageControl, docking controls are wrapped with internally created TTabSheet instanes.
  • edited May 2012 Posts: 0Vote Up0Vote Down
    Roadrunner, your description sounds like something I am currently using as well.
    Attached you'll find a test-project I created when I first tried out LMDDocking.
    (you don't need to manipulate the xml-file, you can do everything quite easily using the events provided by LMD)


    I can't attach a file here. Strange. I get the error "Missing a temporary folder".
    You can download the project here:
Sign In or Register to comment.