-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit4.pas
More file actions
70 lines (54 loc) · 1.43 KB
/
Unit4.pas
File metadata and controls
70 lines (54 loc) · 1.43 KB
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
unit Unit4;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, DateUtils, System.Generics.Collections,
System.Generics.Defaults;
type
TForm4 = class(TForm)
ListBox1: TListBox;
ApplyFilterButton: TButton;
procedure ApplyFilterButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
uses Unit2, Unit3;
{$R *.dfm}
procedure TForm4.ApplyFilterButtonClick(Sender: TObject);
var
i, activeIndex: integer;
groups: array of groupRecord;
group: groupRecord;
begin
if ListBox1.ItemIndex = -1 then
begin
ShowMessage('Âûáåðèòå äåíü íåäåëè.');
exit;
end;
if length(storageFilePath) = 0 then
begin
ShowMessage('Äàííûå íå íàéäåíû.');
exit;
end;
UpdateStringGridFromFile(storageFilePath);
SetLength(groups, Form2.StringGrid1.RowCount - 1);
activeIndex := ListBox1.ItemIndex + 1;
// Skip first row
for i := 1 to Length(groups) do
groups[i - 1] := createGroupFromStringGrid(i);
Form2.StringGrid1.RowCount := 1;
for i := 0 to Length(groups) - 1 do
if DayOfTheWeek(StrToDateTime(groups[i].day)) = activeIndex then
AddGroupToStringGrid(groups[i]);
end;
procedure TForm4.FormCreate(Sender: TObject);
begin
Form4.Color :=$C0DCC0;
end;
end.