Last change
on this file was 75, checked in by chronos, 6 months ago |
- Modified: Removed U prefix from unit names.
- Modified: Updated Common package.
|
File size:
1.7 KB
|
Line | |
---|
1 | unit FormProjectNew;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
---|
7 | ComCtrls;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TFormProjectNew }
|
---|
12 |
|
---|
13 | TFormProjectNew = class(TForm)
|
---|
14 | ButtonOk: TButton;
|
---|
15 | ButtonCancel: TButton;
|
---|
16 | ListView1: TListView;
|
---|
17 | procedure FormShow(Sender: TObject);
|
---|
18 | procedure ListView1Change(Sender: TObject; Item: TListItem;
|
---|
19 | Change: TItemChange);
|
---|
20 | procedure ListView1DblClick(Sender: TObject);
|
---|
21 | procedure ListView1SelectItem(Sender: TObject; Item: TListItem;
|
---|
22 | Selected: Boolean);
|
---|
23 | public
|
---|
24 | procedure UpdateInterface;
|
---|
25 | end;
|
---|
26 |
|
---|
27 |
|
---|
28 | implementation
|
---|
29 |
|
---|
30 | uses
|
---|
31 | Core, FormMain, Project;
|
---|
32 |
|
---|
33 | {$R *.lfm}
|
---|
34 |
|
---|
35 | { TFormProjectNew }
|
---|
36 |
|
---|
37 | procedure TFormProjectNew.FormShow(Sender: TObject);
|
---|
38 | begin
|
---|
39 | UpdateInterface;
|
---|
40 | end;
|
---|
41 |
|
---|
42 | procedure TFormProjectNew.ListView1Change(Sender: TObject; Item: TListItem;
|
---|
43 | Change: TItemChange);
|
---|
44 | begin
|
---|
45 |
|
---|
46 | end;
|
---|
47 |
|
---|
48 | procedure TFormProjectNew.ListView1DblClick(Sender: TObject);
|
---|
49 | begin
|
---|
50 | ButtonOk.Click;
|
---|
51 | end;
|
---|
52 |
|
---|
53 | procedure TFormProjectNew.ListView1SelectItem(Sender: TObject; Item: TListItem;
|
---|
54 | Selected: Boolean);
|
---|
55 | begin
|
---|
56 | ButtonOk.Enabled := Assigned(ListView1.Selected);
|
---|
57 | end;
|
---|
58 |
|
---|
59 | procedure TFormProjectNew.UpdateInterface;
|
---|
60 | var
|
---|
61 | NewItem: TListItem;
|
---|
62 | I: Integer;
|
---|
63 | begin
|
---|
64 | try
|
---|
65 | ListView1.BeginUpdate;
|
---|
66 | ListView1.Items.Clear;
|
---|
67 | with Core.Core do
|
---|
68 | for I := 0 to ProjectTemplates.Count - 1 do
|
---|
69 | with TProjectTemplate(ProjectTemplates[I]) do
|
---|
70 | if (not Assigned(Core.Core.Project) and IsProject) or
|
---|
71 | Assigned(Core.Core.Project) then begin
|
---|
72 | NewItem := ListView1.Items.Add;
|
---|
73 | NewItem.Caption := Name;
|
---|
74 | NewItem.Data := ProjectTemplates[I];
|
---|
75 | end;
|
---|
76 | if ListView1.Items.Count > 0 then
|
---|
77 | ListView1.Selected := ListView1.Items[0];
|
---|
78 | finally
|
---|
79 | ListView1.EndUpdate;
|
---|
80 | end;
|
---|
81 | end;
|
---|
82 |
|
---|
83 | end.
|
---|
84 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.