I have a very simple delphi 2010 form application containing a dock manager, dock site en 1 panel. At FormShow I try to restore the last status, at FormDestroy I want to save it. This only works as long as my panel is docked. If it's floating during program close its state is not saved. It even doesn't appear in the xml-file anymore.
I also want to add some runtime created panels, but they aren't saved in the last status xml either. What am I missing?
Below is the source code of my project.
unit MyDemo;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, LMDDckSite;
type
TForm1 = class(TForm)
LMDDockSite1: TLMDDockSite;
LMDDockManager1: TLMDDockManager;
LMDDockPanel1: TLMDDockPanel;
procedure FormShow(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
APanel : TLMDDockPanel;
begin
APanel := TLMDDockPanel.Create(self);
APanel.Parent := LMDDockSite1;
APanel.Caption := 'Runtime created dock';
LMDDockSite1.DockControl(APanel,nil,alLeft);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
LMDDockManager1.SaveToFile('c:\test\state.xml');
end;
procedure TForm1.FormShow(Sender: TObject);
begin
if FileExists('c:\test\state.xml') then
LMDDockManager1.LoadFromFile('c:\test\state.xml');
end;
end.
Comments