-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathUnit2.pas
More file actions
189 lines (169 loc) · 5.23 KB
/
Unit2.pas
File metadata and controls
189 lines (169 loc) · 5.23 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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
(******************************************************************************)
(* *)
(* Author : Uwe Schächterle (Corpsman) *)
(* *)
(* This file is part of Episode manager *)
(* *)
(* See the file license.md, located under: *)
(* https://github.com/PascalCorpsman/Software_Licenses/blob/main/license.md *)
(* for details about the license. *)
(* *)
(* It is not allowed to change or remove this text from any *)
(* source file of the project. *)
(* *)
(******************************************************************************)
Unit Unit2;
{$MODE ObjFPC}{$H+}
Interface
Uses
SysUtils, Classes, Forms, StdCtrls, CheckLst, Dialogs, Controls, Menus;
Type
{ TForm2 }
TForm2 = Class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
CheckListBox1: TCheckListBox;
Label1: TLabel;
Procedure CheckListBox1DblClick(Sender: TObject);
Procedure FormCreate(Sender: TObject);
Procedure Button5Click(Sender: TObject);
Procedure Button4Click(Sender: TObject);
Procedure Button3Click(Sender: TObject);
Procedure Button1Click(Sender: TObject);
Procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
Procedure DBToLCL;
End;
Var
Form2: TForm2;
Implementation
{$R *.lfm}
Uses
Unit1
, unit5
, uepisodenmanager;
Procedure TForm2.FormCreate(Sender: TObject);
Begin
caption := 'Found entries';
Constraints.MinWidth := 500;
Constraints.MinHeight := 220;
End;
Procedure TForm2.CheckListBox1DblClick(Sender: TObject);
Var
s: String;
d, nd: TDatensatz;
r, t: Integer;
Begin
s := CheckListBox1.Items[CheckListBox1.ItemIndex];
d := TDatabase.PrettyToDatensatz(s);
form5.Init(d);
Case form5.ShowModal Of
mrOK: Begin
nd := form5.lclToDatensatz;
Database.ReplaceWith(d, nd);
t := CheckListBox1.ItemIndex;
r := CheckListBox1.TopIndex;
DBToLCL;
CheckListBox1.ItemIndex := t;
CheckListBox1.TopIndex := r;
End;
mrNo: Begin // Wird zweckentfremdet für "delete"
nd := form5.lclToDatensatz;
If Not Database.DeleteDataset(nd) Then Begin
showmessage('Error, unable to delete dataset.');
exit;
End;
t := CheckListBox1.ItemIndex;
r := CheckListBox1.TopIndex;
DBToLCL;
CheckListBox1.ItemIndex := t;
CheckListBox1.TopIndex := r;
End;
End;
End;
Procedure TForm2.Button5Click(Sender: TObject);
Begin
close;
End;
Procedure TForm2.Button4Click(Sender: TObject);
Var
i: integer;
Begin
For i := 0 To Checklistbox1.Items.count - 1 Do
Checklistbox1.Checked[i] := true;
End;
Procedure TForm2.Button3Click(Sender: TObject);
Var
i: integer;
Begin
For i := 0 To Checklistbox1.Items.count - 1 Do
Checklistbox1.Checked[i] := false;
End;
Procedure TForm2.Button1Click(Sender: TObject);
Var
l: Tstringlist;
r, t, i: integer;
Begin
t := CheckListBox1.ItemIndex;
r := CheckListBox1.TopIndex;
l := TStringList.create;
l.clear;
For i := 0 To Checklistbox1.items.count - 1 Do
If Checklistbox1.Checked[i] Then
l.add(Checklistbox1.Items[i]);
Database.MarkWithValue(l, true);
l.free;
DBToLCL;
CheckListBox1.ItemIndex := t;
CheckListBox1.TopIndex := r;
End;
Procedure TForm2.Button2Click(Sender: TObject);
Var
l: Tstringlist;
r, t, i: integer;
Begin
t := CheckListBox1.ItemIndex;
r := CheckListBox1.TopIndex;
l := TStringList.create;
l.clear;
For i := 0 To Checklistbox1.items.count - 1 Do
If Checklistbox1.Checked[i] Then
l.add(Checklistbox1.Items[i]);
Database.MarkWithValue(l, false);
l.free;
DBToLCL;
CheckListBox1.ItemIndex := t;
CheckListBox1.TopIndex := r;
End;
Procedure TForm2.DBToLCL;
Var
g, i, j, k: Integer;
l: TStringList;
Begin
// Neu Laden
g := 0;
CheckListBox1.Items.BeginUpdate;
CheckListBox1.clear;
For i := 0 To form1.Checklistbox1.Items.count - 1 Do
If form1.Checklistbox1.Checked[i] Then
For j := 0 To form1.Checklistbox2.Items.count - 1 Do
If form1.Checklistbox2.Checked[j] Then Begin
l := Database.gebeAlleDatensaetzemit(form1.Checklistbox1.Items[i], form1.Checklistbox2.Items[j], true);
For k := 0 To l.count - 1 Do Begin
// Extrahieren des Zählers für Gesehen
If pos('yes', copy(l[k], pos('|', l[k]) - 6, 6)) <> 0 Then inc(g);
CheckListBox1.items.add(l[k]);
CheckListBox1.checked[CheckListBox1.items.count - 1] := false;
End;
l.free;
End;
CheckListBox1.Items.EndUpdate;
label1.caption := inttostr(checklistbox1.items.count) + ' found entries. ' + inttostr(g) + ' seen.';
End;
End.