Recent

Author Topic: TAnchorDockPanel - Save and Restore  (Read 1209 times)

kapibara

  • Hero Member
  • *****
  • Posts: 629
TAnchorDockPanel - Save and Restore
« on: December 02, 2023, 01:07:22 am »
I have some AnchorDockPanels with forms docked inside them. Only one such panel is visible at a time. How to save and restore the layout of such panels?

TAnchorDockPanel has a procedure named SaveLayout, is that to be used for this? But how then to write the result to disk? And later restore the panels. Sofar I have only seen examples with DockMaster.SaveLayoutToConfig / LoadLayoutFromConfig

Code: Pascal  [Select][+][-]
  1. procedure SaveLayout(LayoutTree: TAnchorDockLayoutTree;
  2.                      LayoutNode: TAnchorDockLayoutTreeNode);  

There is a demo attached to make it easier to add sample code.
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

zamtmn

  • Hero Member
  • *****
  • Posts: 640
Re: TAnchorDockPanel - Save and Restore
« Reply #1 on: December 02, 2023, 08:32:30 am »
This is the wrong approach. It was originally intended that there would be only one dockpanel in the application. You should review the architecture of your application, or you will have to refine the package to support multiple panels
An example of saving layouts can be found in the examples programs that come with the AnchorDocking package

kapibara

  • Hero Member
  • *****
  • Posts: 629
Re: TAnchorDockPanel - Save and Restore
« Reply #2 on: December 03, 2023, 01:35:51 am »
Thank you.

The demo above is based on the lazarus example.

Happy for any pointer what approach to use, or if this can be done at all:

Switching back and forth between groups of docked forms. Meaning one set of forms docked inside the main form and then switch to another group of forms, hiding the first group of forms.
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

zamtmn

  • Hero Member
  • *****
  • Posts: 640
Re: TAnchorDockPanel - Save and Restore
« Reply #3 on: December 03, 2023, 11:25:56 am »
Save multiple sets of layouts and switch between them when needed?

kapibara

  • Hero Member
  • *****
  • Posts: 629
Re: TAnchorDockPanel - Save and Restore
« Reply #4 on: December 03, 2023, 04:44:58 pm »
I'll go for that. Thanks!
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

 

TinyPortal © 2005-2018