-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.pas
92 lines (74 loc) · 2.05 KB
/
options.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
unit options;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, FileCtrl;
type
TOptionDialog = class(TForm)
Label1: TLabel;
Label2: TLabel;
edTemplateDir: TEdit;
edSaveDir: TEdit;
btnSelectTemplateDir: TButton;
btnSelectSaveDir: TButton;
procedure FormCreate(Sender: TObject);
procedure btnSelectSaveDirClick(Sender: TObject);
procedure btnSelectTemplateDirClick(Sender: TObject);
procedure selSaveDirCanClose(Sender: TObject; var CanClose: Boolean);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
function getTemplateDir : String;
function getSaveDir : String;
end;
var
OptionDialog: TOptionDialog;
implementation
{$R *.dfm}
function TOptionDialog.getTemplateDir : String;
begin
Result := edTemplateDir.Text;
end;
function TOptionDialog.getSaveDir : String;
begin
Result := edSaveDir.Text;
end;
procedure TOptionDialog.selSaveDirCanClose(Sender: TObject;
var CanClose: Boolean);
begin
// check whether a directory is selected and contains the template files.
end;
procedure TOptionDialog.btnSelectTemplateDirClick(Sender: TObject);
var newPath:string;
begin
newPath:= edTemplateDir.Text;
// remove missing directory
if ( not DirectoryExists(newPath)) then
begin;
newPath :='';
edTemplateDir.Text:='a:\nesy';
end;
// open the select-dialog.
if (SelectDirectory(newPath, [], 0)) then
edTemplateDir.Text := newPath;
end;
procedure TOptionDialog.btnSelectSaveDirClick(Sender: TObject);
var newPath : string;
begin
newPath:= edTemplateDir.Text;
// remove missing directory
if (not DirectoryExists(newPath)) then
begin
newPath :='';
edSaveDir.Text:='a:\';
end;
// open the select-dialog.
if (SelectDirectory(newPath, [], 0)) then
edSaveDir.Text:=newPath;
end;
procedure TOptionDialog.FormCreate(Sender: TObject);
begin
edTemplateDir.Text:= GetCurrentDir() + '\diskette\nesy';
end;
end.