-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathugroups.pas
141 lines (121 loc) · 2.65 KB
/
ugroups.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Copyright 2017, Kaj Mikkelsen
// This software is distributed under the GPL 3 license
// The full text of the license can be found in the aboutbox
// as well as in the file "Copying"
unit UGroups;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
Grids;
type
{ TFGroups }
TFGroups = class(TForm)
SaveButton: TButton;
CancelButton: TButton;
SG1: TStringGrid;
procedure CancelButtonClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure SaveButtonClick(Sender: TObject);
procedure SG1Resize(Sender: TObject);
private
{ private declarations }
public
Typ: string;
{ public declarations }
end;
const
MaxPoster = 25;
var
FGroups: TFGroups;
implementation
uses
MyLib;
{$R *.lfm}
{ TFGroups }
procedure TFGroups.FormCreate(Sender: TObject);
var
i: integer;
St: string;
begin
SG1.RowCount := MaxPoster;
RestoreForm(FGroups);
SG1.DefaultColWidth := SG1.Width - 2;
for i := 0 to MaxPoster - 1 do
begin
if i < 10 then
St := Typ + '0' + IntToStr(i)
else
St := Typ + IntToStr(i);
SG1.Cells[0, i] := GetStdIni(Typ, St, '');
end;
end;
procedure TFGroups.CancelButtonClick(Sender: TObject);
var
i: integer;
St: string;
begin
for i := 0 to MaxPoster - 1 do
begin
if i < 10 then
St := typ + '0' + IntToStr(i)
else
St := Typ + IntToStr(i);
SG1.Cells[0, i] := GetStdIni(Typ, St, '');
end;
ModalResult := mrCancel;
end;
procedure TFGroups.FormActivate(Sender: TObject);
var
i: integer;
St: string;
begin
Caption := Typ;
for i := 0 to MaxPoster - 1 do
begin
if i < 10 then
St := typ + '0' + IntToStr(i)
else
St := Typ + IntToStr(i);
SG1.Cells[0, i] := GetStdIni(Typ, St, '');
end;
end;
procedure TFGroups.FormDestroy(Sender: TObject);
begin
SaveForm(FGroups);
end;
procedure TFGroups.SaveButtonClick(Sender: TObject);
var
i, Count: integer;
St: string;
begin
Count := 0;
for I := 0 to MaxPoster - 1 do
begin
if SG1.Cells[0, i] <> '' then
begin
if Count < 10 then
St := Typ + '0' + IntToStr(Count)
else
St := Typ + IntToStr(Count);
PutStdIni(Typ, St, SG1.Cells[0, i]);
Count := Count + 1;
end;
end;
for i := Count to MaxPoster - 1 do
begin
if Count < 10 then
St := Typ + '0' + IntToStr(i)
else
St := Typ + IntToStr(i);
PutStdIni(Typ, St, '');
end;
ModalResult := mrOk;
end;
procedure TFGroups.SG1Resize(Sender: TObject);
begin
SG1.DefaultColWidth := SG1.Width - 2;
end;
end.