unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
StdCtrls , SynMemo, CheckLst;
type
{ TForm1 }
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Label1: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label2: TLabel;
Label20: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Memo1: TMemo;
Memo2: TMemo;
OpenDialog1: TOpenDialog;
procedure ApplicationProperties1Exception(Sender: TObject; E:
Exception);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
uses printers;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
f : TextFile;
a, b :
string;
nummer, datum, zeit, gewicht, einheit, waage :
string;
zaehler, atmp : integer;
begin
//AssignFile(f, 'z:\waage-daten\waage1.txt');
AssignFile(f, '
d:\waage3.txt');
Reset(f);
Memo1.Lines.clear;
zaehler := 0;
While not eof(f)
do begin
Readln(f, a);
Memo1.Lines.add(a);
// ermitteln der vorletzen Zeile
b := Memo1.Lines[Memo1.Lines.Count - 2];
Memo2.Lines.clear;
Memo2.Lines.add(b);
// ausschneiden der einzelnen werte
nummer := copy(b, 1, 6);
datum := copy(b, 8, 8);
zeit := copy(b, 17, 5);
gewicht := copy(b, 24, 6);
einheit := copy(b, 31, 2);
waage := copy(b, 34, 2);
// hier die werte auf den Labels zeigen
Label1.caption := (nummer);
Label2.caption := (datum);
Label3.caption := (zeit);
LAbel4.caption := (gewicht);
Label5.caption := (einheit);
Label6.caption := (waage);
end;
CloseFile(f);
end;
procedure TForm1.ApplicationProperties1Exception(Sender: TObject; E:
Exception);
begin
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
application.terminate;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
printer.begindoc;
with Printer.Canvas
do begin
//Font.Size := 21;
TextOut(50, 2, '
Überschrift');
TextOut(50, 150, '
------------ ');
//font.size := 14;
TextOut(50, 500, '
nummer');
TextOut(1250, 500, '
waage ');
end;
printer.enddoc;
end;
procedure TForm1.Button4Click(Sender: TObject);
var tf: TextFile;
begin
AssignFile(tf, '
LPT1');
Rewrite(tf);
WriteLn(tf, '
<STX>L');
WriteLn(tf, '
D11<CR>');
WriteLn(tf, '
1A00000001501000123456789<CR>');
WriteLn(tf, '
121100000000100Barcode A<CR>');
WriteLn(tf, '
E');
CloseFile(tf);
end;
initialization
{$I unit1.lrs}
end.