Ignore:
Timestamp:
Mar 8, 2011, 12:58:28 PM (14 years ago)
Author:
george
Message:
  • Added: Store and restore basic form properties with use of layouts.
Location:
Docking/CoolDocking/Demo/IDE
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Docking/CoolDocking/Demo/IDE

    • Property svn:ignore
      •  

        old new  
        11IDE.exe
        22lib
         3Layout.xml
  • Docking/CoolDocking/Demo/IDE/UMainForm.pas

    r178 r179  
    1212  UWatchListForm, UThreadStatusForm, USourceEditorForm;
    1313
     14const
     15  DockLayoutFileName = 'Layout.xml';
     16
    1417type
    1518
     
    1821  TMainForm = class(TForm)
    1922  published
     23    AExit: TAction;
    2024    ANewFile: TAction;
    2125    ACustomizeDocking: TAction;
     
    5357    MenuItem22: TMenuItem;
    5458    MenuItem23: TMenuItem;
     59    MenuItem24: TMenuItem;
    5560    MenuItem9: TMenuItem;
    5661    MenuItem8: TMenuItem;
     
    6974    procedure ACustomizeDockingExecute(Sender: TObject);
    7075    procedure ADesktopSaveExecute(Sender: TObject);
     76    procedure AExitExecute(Sender: TObject);
    7177    procedure ANewFileExecute(Sender: TObject);
    7278    procedure AViewThreadStatusExecute(Sender: TObject);
     
    8187    procedure AViewWatchListExecute(Sender: TObject);
    8288    procedure AViewWindowListExecute(Sender: TObject);
     89    procedure ComboBox1Select(Sender: TObject);
     90    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     91    procedure FormShow(Sender: TObject);
    8392  public
    84     { public declarations }
    85   end;
     93  end;
    8694
    8795var
     
    109117end;
    110118
     119procedure TMainForm.ComboBox1Select(Sender: TObject);
     120begin
     121  if ComboBox1.ItemIndex <> - 1 then
     122    TCoolDockLayout(CoolDockLayoutList1.Items[ComboBox1.ItemIndex]).Restore;
     123end;
     124
     125procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
     126begin
     127  CoolDockLayoutList1.SaveToFile(DockLayoutFileName);
     128end;
     129
     130procedure TMainForm.FormShow(Sender: TObject);
     131begin
     132  with CoolDockLayoutList1 do begin
     133    if FileExistsUTF8(DockLayoutFileName) then
     134      LoadFromFile(DockLayoutFileName);
     135    PopulateStringList(ComboBox1.Items);
     136  end;
     137end;
     138
    111139procedure TMainForm.AViewProjectManagerExecute(Sender: TObject);
    112140begin
     
    140168
    141169procedure TMainForm.ADesktopSaveExecute(Sender: TObject);
    142 begin
    143 
     170var
     171  NewLayout: TCoolDockLayout;
     172begin
     173  if ComboBox1.Items.IndexOf(ComboBox1.Text) = -1 then begin
     174    NewLayout := TCoolDockLayout.Create;
     175    NewLayout.Name := ComboBox1.Text;
     176    NewLayout.Store;
     177    CoolDockLayoutList1.Items.Add(NewLayout);
     178  end else
     179    TCoolDockLayout(CoolDockLayoutList1.Items[ComboBox1.ItemIndex]).Store;
     180  CoolDockLayoutList1.PopulateStringList(ComboBox1.Items);
     181end;
     182
     183procedure TMainForm.AExitExecute(Sender: TObject);
     184begin
     185  Close;
    144186end;
    145187
Note: See TracChangeset for help on using the changeset viewer.