Rev 1 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 4 | ||
---|---|---|---|
1 | unit ExtractorError; |
1 | unit ExtractorError; |
2 | 2 | ||
3 | interface |
3 | interface |
4 | 4 | ||
5 | // TODO: Dialog sizeable |
- | |
6 | - | ||
7 | uses |
5 | uses |
8 | Forms, StdCtrls, ExtCtrls, Controls, Graphics, Classes; |
6 | Forms, StdCtrls, ExtCtrls, Controls, Graphics, Classes, Dialogs; |
9 | 7 | ||
10 | type |
8 | type |
11 | TErrorForm = class(TForm) |
9 | TErrorForm = class(TForm) |
12 | ErrorList: TListBox; |
10 | ErrorList: TListBox; |
13 | ErrorImg: TImage; |
11 | ErrorImg: TImage; |
14 | ErrorLabel: TLabel; |
12 | ErrorLabel: TLabel; |
15 | OKBtn: TButton; |
13 | OKBtn: TButton; |
- | 14 | SaveBtn: TButton; |
|
- | 15 | SaveDialog: TSaveDialog; |
|
- | 16 | procedure FormResize(Sender: TObject); |
|
- | 17 | procedure SaveBtnClick(Sender: TObject); |
|
16 | public |
18 | public |
17 | function ErrorsAvailable: boolean; |
19 | function ErrorsAvailable: boolean; |
18 | procedure NewError(Filename: string); |
20 | procedure NewError(Filename: string); |
19 | end; |
21 | end; |
20 | 22 | ||
21 | var |
23 | var |
22 | ErrorForm: TErrorForm; |
24 | ErrorForm: TErrorForm; |
23 | 25 | ||
24 | implementation |
26 | implementation |
25 | 27 | ||
26 | {$R *.dfm} |
28 | {$R *.dfm} |
27 | 29 | ||
28 | function TErrorForm.ErrorsAvailable: boolean; |
30 | function TErrorForm.ErrorsAvailable: boolean; |
29 | begin |
31 | begin |
30 | result := ErrorList.Items.Count > 0; |
32 | result := ErrorList.Items.Count > 0; |
31 | end; |
33 | end; |
32 | 34 | ||
- | 35 | procedure TErrorForm.FormResize(Sender: TObject); |
|
- | 36 | begin |
|
- | 37 | ErrorList.Width := ClientWidth - ErrorList.Left - ErrorImg.Left; |
|
- | 38 | ErrorList.Height := ClientHeight - ErrorList.Top - (2 * ErrorImg.Left + OkBtn.Height); |
|
- | 39 | OkBtn.Top := ErrorList.Top + ErrorList.Height + ErrorImg.Left; |
|
- | 40 | OkBtn.Left := ErrorList.Left + ErrorList.Width - OkBtn.Width; |
|
- | 41 | SaveBtn.Top := OkBtn.Top; |
|
- | 42 | end; |
|
- | 43 | ||
33 | procedure TErrorForm.NewError(Filename: string); |
44 | procedure TErrorForm.NewError(Filename: string); |
34 | begin |
45 | begin |
35 | // In future: Also add reason into list? |
46 | // In future: Also add reason into list? |
36 | ErrorList.Items.Add(Filename); |
47 | ErrorList.Items.Add(Filename); |
37 | end; |
48 | end; |
- | 49 | ||
- | 50 | procedure TErrorForm.SaveBtnClick(Sender: TObject); |
|
- | 51 | begin |
|
- | 52 | if SaveDialog.Execute then |
|
- | 53 | begin |
|
- | 54 | ErrorList.Items.SaveToFile(SaveDialog.FileName); |
|
- | 55 | end; |
|
- | 56 | end; |
|
38 | 57 | ||
39 | end. |
58 | end. |
40 | 59 |