-
Notifications
You must be signed in to change notification settings - Fork 0
/
uvelgfirma.pas
111 lines (88 loc) · 1.9 KB
/
uvelgfirma.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
109
110
111
unit uvelgfirma;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls;
type
{ TFVelgFirma }
TFVelgFirma = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
LB1: TListBox;
Panel1: TPanel;
Panel2: TPanel;
procedure Button3Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure LB1DblClick(Sender: TObject);
private
procedure PopulateLb;
function CreateDirectory: string;
public
end;
var
FVelgFirma: TFVelgFirma;
implementation
uses
global, mylib, fileutil,MyInputBox;
{$R *.lfm}
{ TFVelgFirma }
procedure TFVelgFirma.FormCreate(Sender: TObject);
begin
TransCaption(Sender as TForm, rsStrings);
RestoreForm(Sender as TForm);
end;
procedure TFVelgFirma.FormDestroy(Sender: TObject);
begin
SaveForm(Sender as TForm);
end;
procedure TFVelgFirma.LB1DblClick(Sender: TObject);
begin
Modalresult := mrOK;
end;
procedure TFVelgFirma.PopulateLb;
var
i: integer;
begin
lb1.Items.Clear;
FindAllDirectories(LB1.Items, DatDir, False, ';');
for i := 0 to Pred(lb1.Items.Count) do
begin
lb1.items[i] := RightMostCh('/', lb1.items[i]);
end;
if LB1.Items.Count > 0 then
begin
Lb1.ItemIndex := 0;
Button1.Enabled := True;
end;
end;
function TFVelgFirma.CreateDirectory: string;
var
st: string;
begin
St := '';
if FMyInputBox.GetInput(rsDanNytFirma, rsFirmanavn, St) then
Result := st
else
Result := '';
end;
procedure TFVelgFirma.Button3Click(Sender: TObject);
var
st: string;
begin
st := CreateDirectory;
if St <> '' then
if createdir(Datdir + St) then
PopulateLb
else
MessageDlg(rsNoFirm, mtError, [mbOK], 0);
end;
procedure TFVelgFirma.FormActivate(Sender: TObject);
begin
PopulateLb;
lb1.SetFocus;
end;
end.