1 | unit UMainForm;
|
---|
2 |
|
---|
3 | {$mode Delphi}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
9 | ComCtrls, ExtCtrls, Buttons, Menus, UCDMaster, UCDCustomize, UCDClient,
|
---|
10 | UDockForm, UComponentTree, UCDWindowList, UCDConjoinForm, UCDManager,
|
---|
11 | UCDCommon, UCDManagerRegions;
|
---|
12 |
|
---|
13 | type
|
---|
14 |
|
---|
15 | { TMainForm }
|
---|
16 |
|
---|
17 | TMainForm = class(TForm)
|
---|
18 | Button1: TButton;
|
---|
19 | Button2: TButton;
|
---|
20 | CoolDockClient1: TCDClient;
|
---|
21 | CoolDockCustomize1: TCDCustomize;
|
---|
22 | CoolDockMaster1: TCDMaster;
|
---|
23 | CoolDockWindowList1: TCDWindowList;
|
---|
24 | MainMenu1: TMainMenu;
|
---|
25 | MenuItem1: TMenuItem;
|
---|
26 | MenuItem2: TMenuItem;
|
---|
27 | MenuItem3: TMenuItem;
|
---|
28 | MenuItem4: TMenuItem;
|
---|
29 | Panel1: TPanel;
|
---|
30 | procedure Button1Click(Sender: TObject);
|
---|
31 | procedure Button2Click(Sender: TObject);
|
---|
32 | procedure FormCreate(Sender: TObject);
|
---|
33 | procedure FormDestroy(Sender: TObject);
|
---|
34 | procedure FormShow(Sender: TObject);
|
---|
35 | procedure MenuItem2Click(Sender: TObject);
|
---|
36 | procedure MenuItem4Click(Sender: TObject);
|
---|
37 | procedure PageControl1Change(Sender: TObject);
|
---|
38 | private
|
---|
39 | procedure DockSiteShowExecute(Sender: TObject);
|
---|
40 | procedure DockSiteHideExecute(Sender: TObject);
|
---|
41 | public
|
---|
42 | FormIndex: Integer;
|
---|
43 | DockForms: TList;
|
---|
44 | function NewDockForm: TDockForm;
|
---|
45 | end;
|
---|
46 |
|
---|
47 | var
|
---|
48 | MainForm: TMainForm;
|
---|
49 |
|
---|
50 | implementation
|
---|
51 |
|
---|
52 | {$R *.lfm}
|
---|
53 |
|
---|
54 | { TMainForm }
|
---|
55 |
|
---|
56 | procedure TMainForm.FormCreate(Sender: TObject);
|
---|
57 | begin
|
---|
58 | DockForms := TList.Create;
|
---|
59 | end;
|
---|
60 |
|
---|
61 | procedure TMainForm.FormDestroy(Sender: TObject);
|
---|
62 | begin
|
---|
63 | DockForms.Free;
|
---|
64 | end;
|
---|
65 |
|
---|
66 | procedure TMainForm.FormShow(Sender: TObject);
|
---|
67 | var
|
---|
68 | ConjoinedDockForm1: TCDConjoinForm;
|
---|
69 | ConjoinedDockForm2: TCDConjoinForm;
|
---|
70 | Form1: TDockForm;
|
---|
71 | Form2: TDockForm;
|
---|
72 | Form3: TDockForm;
|
---|
73 | begin
|
---|
74 | Form1 := NewDockForm;
|
---|
75 | Form1.ManualDock(Panel1, nil, alRight);
|
---|
76 | Form2 := NewDockForm;
|
---|
77 | Form2.ManualDock(Panel1, nil, alRight);
|
---|
78 | Form3 := NewDockForm;
|
---|
79 | Form3.ManualDock(Panel1, nil, alRight);
|
---|
80 | TCDManagerRegionsItem(TCDPanelHeader(Form2.Parent.Parent).DockItem).SetCenter;
|
---|
81 |
|
---|
82 | //Form1 := NewDockForm;
|
---|
83 | //Form1.ManualDock(Panel1);
|
---|
84 | //NewDockForm.ManualDock(Form1);
|
---|
85 | //TCDManager(Panel1.DockManager).DockStyle := dsTabs;
|
---|
86 | //NewDockForm.ManualDock(Panel1);
|
---|
87 | (* ConjoinedDockForm1 := TCDManager(Panel1.DockManager).CreateConjoinForm;
|
---|
88 | ConjoinedDockForm1.Name := 'Model';;
|
---|
89 | ConjoinedDockForm1.Show;
|
---|
90 | //TCoolDockManager(ConjoinedDockForm1.Panel.DockManager).TabsPos := hpLeft;
|
---|
91 | ConjoinedDockForm1.ManualDock(Panel1);
|
---|
92 | //TCDManager(ConjoinedDockForm1.DockManager).DockStyle := dsTabs;
|
---|
93 | NewDockForm.ManualDock(ConjoinedDockForm1);
|
---|
94 | NewDockForm.ManualDock(ConjoinedDockForm1);
|
---|
95 | //NewDockForm.ManualDock(ConjoinedDockForm1);
|
---|
96 | //NewDockForm.ManualDock(TForm(DockForms[0]));
|
---|
97 | //NewDockForm.ManualDock(TForm(DockForms[0]));
|
---|
98 | //NewDockForm.ManualDock(TForm(DockForms[0]));
|
---|
99 | //TCustomDockManager(TDockForm(DockForms[0]).DockManager).DockStyle := dsTabs; *)
|
---|
100 | end;
|
---|
101 |
|
---|
102 | procedure TMainForm.MenuItem2Click(Sender: TObject);
|
---|
103 | begin
|
---|
104 | CoolDockCustomize1.Execute;
|
---|
105 | end;
|
---|
106 |
|
---|
107 | procedure TMainForm.MenuItem4Click(Sender: TObject);
|
---|
108 | begin
|
---|
109 | CoolDockWindowList1.Execute;
|
---|
110 | end;
|
---|
111 |
|
---|
112 | procedure TMainForm.PageControl1Change(Sender: TObject);
|
---|
113 | begin
|
---|
114 |
|
---|
115 | end;
|
---|
116 |
|
---|
117 | procedure TMainForm.DockSiteShowExecute(Sender: TObject);
|
---|
118 | begin
|
---|
119 | if Sender is TControl then
|
---|
120 | DebugLog(TControl(Sender).Name + ' Show');
|
---|
121 | end;
|
---|
122 |
|
---|
123 | procedure TMainForm.DockSiteHideExecute(Sender: TObject);
|
---|
124 | begin
|
---|
125 | if Sender is TControl then
|
---|
126 | DebugLog(TControl(Sender).Name + ' Hide');
|
---|
127 | end;
|
---|
128 |
|
---|
129 | function TMainForm.NewDockForm: TDockForm;
|
---|
130 | begin
|
---|
131 | Application.CreateForm(TDockForm, Result);
|
---|
132 | // Result := TDockForm.Create(Self);
|
---|
133 | Result.Name := 'Form' + IntToStr(FormIndex);
|
---|
134 | Result.CoolDockClient1.Name := 'CoolDockClient' + IntToStr(FormIndex);
|
---|
135 | Result.Caption := Result.Name;
|
---|
136 | Result.Memo1.Text := Result.Name;
|
---|
137 | TCDManager(Result.DockManager).OnDockSiteHide := DockSiteHideExecute;
|
---|
138 | TCDManager(Result.DockManager).OnDockSiteShow := DockSiteShowExecute;
|
---|
139 | //Result.DragKind := dkDock;
|
---|
140 | //Result.DragMode := dmAutomatic;
|
---|
141 | //Result.DockSite := True;
|
---|
142 | //Result.UseDockManager := True;
|
---|
143 | Inc(FormIndex);
|
---|
144 | Result.Show;
|
---|
145 | DockForms.Add(Result);
|
---|
146 | end;
|
---|
147 |
|
---|
148 | procedure TMainForm.Button1Click(Sender: TObject);
|
---|
149 | begin
|
---|
150 | NewDockForm;
|
---|
151 | end;
|
---|
152 |
|
---|
153 | procedure TMainForm.Button2Click(Sender: TObject);
|
---|
154 | begin
|
---|
155 | ComponentTree.Show;
|
---|
156 | end;
|
---|
157 |
|
---|
158 | end.
|
---|
159 |
|
---|