source: trunk/IDE/Forms/FormProjectNew.pas

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 
1unit FormProjectNew;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
7 ComCtrls;
8
9type
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
28implementation
29
30uses
31 Core, FormMain, Project;
32
33{$R *.lfm}
34
35{ TFormProjectNew }
36
37procedure TFormProjectNew.FormShow(Sender: TObject);
38begin
39 UpdateInterface;
40end;
41
42procedure TFormProjectNew.ListView1Change(Sender: TObject; Item: TListItem;
43 Change: TItemChange);
44begin
45
46end;
47
48procedure TFormProjectNew.ListView1DblClick(Sender: TObject);
49begin
50 ButtonOk.Click;
51end;
52
53procedure TFormProjectNew.ListView1SelectItem(Sender: TObject; Item: TListItem;
54 Selected: Boolean);
55begin
56 ButtonOk.Enabled := Assigned(ListView1.Selected);
57end;
58
59procedure TFormProjectNew.UpdateInterface;
60var
61 NewItem: TListItem;
62 I: Integer;
63begin
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;
81end;
82
83end.
84
Note: See TracBrowser for help on using the repository browser.