Difference between revisions of "Anchor Docking"

From Lazarus wiki
Jump to navigationJump to search
Line 13: Line 13:
 
*Page docking. Forms can be docked not only left/right/above/below, but in pages too. A TPageControl is automatically created. A page can contain arbitrary docked forms too, including paged docked forms, allowing nested pages.
 
*Page docking. Forms can be docked not only left/right/above/below, but in pages too. A TPageControl is automatically created. A page can contain arbitrary docked forms too, including paged docked forms, allowing nested pages.
 
*Easy use: Just drop a TLazControlDocker onto the form that should be dockable, give it an unique name and connect it to the TLazDockingManager.
 
*Easy use: Just drop a TLazControlDocker onto the form that should be dockable, give it an unique name and connect it to the TLazDockingManager.
*Not only forms, but any TWinControl can be made dockable.
+
*Not only forms, but any TWinControl can be made dockable. (needs testing)
 
*Popup menu: User interface via platform independent popup menu. TLazControlDocker adds by default a popup menu 'Docking' to the PopupMenu of the form. This menu item opens a dialog where the user can setup the docking.
 
*Popup menu: User interface via platform independent popup menu. TLazControlDocker adds by default a popup menu 'Docking' to the PopupMenu of the form. This menu item opens a dialog where the user can setup the docking.
 
*Easy docking via code. For example dock Form2 left of Form1:
 
*Easy docking via code. For example dock Form2 left of Form1:
 
   DockingManager.Manager.InsertControl(Form2,alLeft,Form1);
 
   DockingManager.Manager.InsertControl(Form2,alLeft,Form1);
*Can save layouts to xml config files. The layout information is stored for each dockable control and if the application gets more or less dockable controls the old layout will still work.  
+
*Can save/load layouts from/to xml config files. The layout information is stored for each dockable control and if the application gets more or less dockable controls the old layout will still work.  
*Dynamic and automatic restore layout algorithm. The layout is restored when a control is shown. That means no matter when or how a form is shown, the docking manager will automatically dock it according to the last known layout of this form. It will automatically resize the neighborhood. (already works for many layouts, needs some imporvements for complex cases).
+
*Dynamic and automatic restore layout algorithm. The layout is restored when a control is shown. That means no matter when or how a form is shown, the docking manager will automatically dock it according to the last known layout of this form. It will automatically resize the neighborhood. (already works for many layouts, needs some improvements for complex cases).
 +
 
 +
===ToDos===
 +
 
 +
*Improve and harden the restore algorithm until it is good enough for the IDE.
 +
*Implement automatic menu merging in the LCL.
 +
*Fix the winapi widgetset for docked forms.
 +
*Write examples and docs
 +
*Add it to the IDE component palette

Revision as of 18:08, 30 December 2007

About docking in general see Docking.

Anchor Docking with TLazDockingManager

The TLazDockingManager is part of the LCL and can be found unit LDockCtrl. It is not yet complete and therefore not yet part of the IDE component palette. An example can be found in lazarus/examples/anchordocking/docking1.lpi.

Features

  • By using the LCL's anchors almost any layout is possible. It is for example not limited to the strict top/bottom/left/right order of the Align property.
  • It does not use hidden panels. What you see is how it is structured.
  • TSplitter are automatically inserted between docked forms
  • Page docking. Forms can be docked not only left/right/above/below, but in pages too. A TPageControl is automatically created. A page can contain arbitrary docked forms too, including paged docked forms, allowing nested pages.
  • Easy use: Just drop a TLazControlDocker onto the form that should be dockable, give it an unique name and connect it to the TLazDockingManager.
  • Not only forms, but any TWinControl can be made dockable. (needs testing)
  • Popup menu: User interface via platform independent popup menu. TLazControlDocker adds by default a popup menu 'Docking' to the PopupMenu of the form. This menu item opens a dialog where the user can setup the docking.
  • Easy docking via code. For example dock Form2 left of Form1:
 DockingManager.Manager.InsertControl(Form2,alLeft,Form1);
  • Can save/load layouts from/to xml config files. The layout information is stored for each dockable control and if the application gets more or less dockable controls the old layout will still work.
  • Dynamic and automatic restore layout algorithm. The layout is restored when a control is shown. That means no matter when or how a form is shown, the docking manager will automatically dock it according to the last known layout of this form. It will automatically resize the neighborhood. (already works for many layouts, needs some improvements for complex cases).

ToDos

  • Improve and harden the restore algorithm until it is good enough for the IDE.
  • Implement automatic menu merging in the LCL.
  • Fix the winapi widgetset for docked forms.
  • Write examples and docs
  • Add it to the IDE component palette