Changeset 6 for DockManagement/Demo


Ignore:
Timestamp:
Dec 9, 2011, 7:22:16 AM (13 years ago)
Author:
chronos
Message:
  • Added: Some basic functionality for conjoined form support.
Location:
DockManagement/Demo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • DockManagement/Demo/UMainForm.dfm

    r5 r6  
    33  Top = 0
    44  Caption = 'DockManagement demo'
    5   ClientHeight = 202
    6   ClientWidth = 398
     5  ClientHeight = 372
     6  ClientWidth = 540
    77  Color = clBtnFace
    88  Font.Charset = DEFAULT_CHARSET
  • DockManagement/Demo/UMainForm.pas

    r5 r6  
    44
    55uses
    6   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    7   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, UDockForm, Vcl.Menus, UDockManagement;
     6  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
     7  Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, UDockForm, Vcl.Menus, UDockManagement, Generics.Collections;
    88
    99type
     
    1818  private
    1919    RegistryKey: string;
     20    function NewDockForm: TDockForm;
    2021  public
     22    Forms: TObjectList<TForm>;
    2123    FormCounter: Integer;
    2224    BaseDockPanel: TDBaseDockPanel;
     
    3840procedure TMainForm.FormCreate(Sender: TObject);
    3941begin
     42  Forms := TObjectList<TForm>.Create;
    4043  CustomDockManager := TDDockManager.Create(Self);
    4144  CustomDockManager.RegistryKey := RegistryKey;
     
    5457  BaseDockPanel.Free;
    5558  CustomDockManager.Free;
     59  Forms.Free;
    5660end;
    5761
    5862procedure TMainForm.FormShow(Sender: TObject);
     63var
     64  I: Integer;
    5965begin
    6066 // Init dock init list
     
    6874  end;
    6975  //CustomDockManager.LoadFromRegistry
     76  for I := 0 to 5 do begin
     77    Forms.Add(NewDockForm);
     78  end;
     79end;
     80
     81function TMainForm.NewDockForm: TDockForm;
     82begin
     83  Inc(FormCounter);
     84  Result := TDockForm.Create(MainForm);
     85  Result.Memo1.Text := 'Form ' + IntToStr(FormCounter);
     86  Result.Memo1.Align := alClient;
     87  Result.Caption := 'Form ' + IntToStr(FormCounter);
     88  Result.Show;
     89  CustomDockManager.RegisterDockForm(Result, 200, 200, Result.Name, True);
    7090end;
    7191
    7292procedure TMainForm.Newform1Click(Sender: TObject);
    73 var
    74   NewForm: TDockForm;
    7593begin
    76   Inc(FormCounter);
    77   NewForm := TDockForm.Create(MainForm);
    78   NewForm.Caption := 'Form ' + IntToStr(FormCounter);
    79   NewForm.Show;
    80   CustomDockManager.RegisterDockForm(NewForm, 200, 200, NewForm.Name, True);
     94  Forms.Add(NewDockForm);
    8195end;
    8296
Note: See TracChangeset for help on using the changeset viewer.