-
Notifications
You must be signed in to change notification settings - Fork 3
/
LinkForm.pas
108 lines (93 loc) · 2.32 KB
/
LinkForm.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
unit LinkForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TFLinkForm = class(TForm)
BLocate: TButton;
ELocation: TEdit;
EDescription: TEdit;
LDescription: TLabel;
LLocation : TLabel;
BOK: TButton;
BCancel: TButton;
procedure BCancelClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure BLocateClick(Sender: TObject);
procedure BOKClick(Sender: TObject);
procedure ELocationChange(Sender: TObject);
procedure EDescriptionChange(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
Mode : byte;
Description : string;
Location: String;
posX,posY : integer;
{ Public declarations }
end;
var
FLinkForm: TFLinkForm;
implementation
uses SBMain;
{$R *.DFM}
procedure TFLinkForm.BCancelClick(Sender: TObject);
begin
Description:='';
EDescription.Text:='';
Location:='';
ELocation.Text:='';
close;
end;
procedure TFLinkForm.FormActivate(Sender: TObject);
begin
Description:='';
Location:='';
if Mode=1 then begin
BLocateClick(Sender);
ELocationChange(Sender);
EDescription.SetFocus;
EDescription.SelectAll;
Mode:=0;
end;
end;
procedure TFLinkForm.BLocateClick(Sender: TObject);
var extend : String;
StoreFile : String;
begin
FSongbase.FileOpen.Filter:='All Files|*.*';
if (FSongbase.FileOpen.Execute) then begin
ELocation.Text:=FSongbase.FileOpen.FileName;
end;
extend:='';
StoreFile:=ELocation.Text;
while (pos('.',StoreFile)>0) do begin
extend:=Storefile[length(Storefile)]+extend;
Storefile:=copy(Storefile,1,length(Storefile)-1);
end;
if (EDescription.Text='') then
EDescription.Text:=FSongbase.ETitle.Text+ ' - '+extend;
ELocationChange(Sender);
end;
procedure TFLinkForm.BOKClick(Sender: TObject);
begin
Description:=EDescription.text;
Location:=ELocation.text;
close;
end;
procedure TFLinkForm.ELocationChange(Sender: TObject);
begin
BOK.Enabled:=(ELocation.Text<>'') and (EDescription.Text<>'') and (FileExists(ELocation.Text));
end;
procedure TFLinkForm.EDescriptionChange(Sender: TObject);
begin
BOK.Enabled:=(ELocation.Text<>'') and (EDescription.Text<>'');
end;
procedure TFLinkForm.FormShow(Sender: TObject);
begin
top:=posY;
left:=posX;
end;
end.