This repository was archived by the owner on Dec 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit4.pas
153 lines (124 loc) · 3.45 KB
/
Unit4.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
142
143
144
145
146
147
148
149
150
151
152
153
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ExtCtrls, Buttons, Printers, jpeg, ActnList;
type
TForm4 = class(TForm)
Label1: TLabel;
Memo1: TRichEdit;
BitBtn1: TBitBtn;
Label2: TLabel;
Label3: TLabel;
BitBtn2: TBitBtn;
Image1: TImage;
ActionList1: TActionList;
Action1: TAction;
Timer1: TTimer;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Action1Execute(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form4: TForm4;
implementation
uses Unit1, Unit2, Unit3;
{$R *.dfm}
function explode(cDelimiter, sValue : string; iCount : integer) : TArray;
var
s : string; i,p : integer;
begin
s := sValue; i := 0;
while length(s) > 0 do
begin
inc(i);
SetLength(result, i);
p := pos(cDelimiter,s);
if ( p > 0 ) and ( ( i < iCount ) OR ( iCount = 0) ) then
begin
result[i - 1] := copy(s,0,p-1);
{updated, thanks Irfan}
s := copy(s,p + length(cDelimiter),length(s));
end else
begin result[i - 1] := s;
s := '';
end;
end;
end;
procedure TForm4.Action1Execute(Sender: TObject);
begin
Form1.Button4.Click;
end;
procedure TForm4.BitBtn1Click(Sender: TObject);
var
r: TRect;
begin
if (printer.Printers.count = 0) then begin
showmessage('Kein Drucker vorhanden!') ;
exit;exit;
end;
r.left:=2;
r.Top:=2;
r.Right:=1;
Memo1.Pagerect:=r;
Memo1.Print('Cadac - Fehlerliste');
end;
procedure TForm4.BitBtn2Click(Sender: TObject);
begin
Memo1.Text:='';
Form1.Left:=Form4.Left;
Form1.Top:=Form4.Top;
Form1.Show;
Form4.Hide;
end;
procedure TForm4.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Form1.Close;
end;
procedure TForm4.FormCreate(Sender: TObject);
begin
Caption:=Form1.name+' [Fehlerliste drucken]';
Constraints.MaxHeight:=Constraints.MinHeight;
Constraints.MaxWidth:=Constraints.MinWidth;
Image1.Picture:=Form1.Image1.Picture;
end;
procedure TForm4.FormShow(Sender: TObject);
var m:TStringlist;
tar: Tarray;
I:integer;
TabWidth, COLWIDTH : Integer;
begin
Memo1.Text:='';
m:=TStringlist.Create;
m.LoadFromFile(Form1.FileCache);
if m.Text='' then begin Timer1.Enabled:=True; end;
Memo1.Lines.Add('--------------------------------------- Datum: '+DateToStr(Date())+' -------------------------------------------');
for I := 0 to m.Count - 1 do begin
tar := explode('|', m[I], 0);
tar[0]:=StringReplace(tar[0], '[]', ' // ', [rfReplaceAll]);
tar[1]:=StringReplace(tar[1], '[]', ' // ', [rfReplaceAll]);
Memo1.Lines.Add(''+tar[1]+#10+' _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _'+#9+' | '+tar[0]);
memo1.Lines.add('');
end;
COLWIDTH := 15;
TabWidth := ColWidth shl 2;
Memo1.Perform(EM_SETTABSTOPS, 1, Integer(@TabWidth));
m.Free;
m:=TStringlist.Create;
m.SaveToFile(Form1.FileCache);
m.Free;
end;
procedure TForm4.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled:=False;
BitBtn2.Click;
end;
end.