unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
Variable = ^Tzeiger;
Tzeiger =
record
Name :
string;
Tele :
string;
Mail :
string ;
next : Variable;
end;
TForm1 =
class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
ListBox1: TListBox;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Anker : Variable;
Aktuell : Variable;
implementation
{$R *.dfm}
Type Tcaption =
type String;
procedure TForm1.FormActivate(Sender: TObject);
begin
anker :=
nil;
aktuell :=
nil;
end;
procedure boxakk;
var z : Variable;
begin
z:= anker;
Form1.ListBox1.Clear;
while (z^.next <>
nil)
do
begin
Form1.ListBox1.Items.Add(z^.
Name);
z := z^.Next;
end;
Form1.ListBox1.Items.Add(z^.
name)
end;
procedure suchen;
var z : Variable;
begin
z:= anker;
while (z^.
name <> Form1.Edit1.text)
and (z^.next <>
nil)
do
z := z^.Next;
aktuell := z ;
Form1.Label1.Caption := aktuell^.
Name;
Form1.Label2.Caption := aktuell^.Tele;
Form1.Label3.Caption := aktuell^.Mail;
boxakk;
end;
procedure Add;
var
temp,temp2: Variable;
begin
New (temp);
temp.
Name := Form1.Edit1.Text;
temp.Tele := Form1.Edit2.Text;
temp.Mail := Form1.Edit3.Text;
temp.next:=
nil;
if anker =
nil
then anker := temp
else
begin
temp2:= Anker;
while (temp2^.next <>
nil)
do
temp2 := temp2^.next;
temp2^.next:=temp;
end;
aktuell := temp;
Form1.Label1.Caption := aktuell^.
Name;
Form1.Label2.Caption := aktuell^.Tele;
Form1.Label3.Caption := aktuell^.Mail;
boxakk;
end;
procedure vor;
begin
if aktuell^.next <>
nil then
aktuell := aktuell^.next;
Form1.Label1.Caption := aktuell^.
Name;
Form1.Label2.Caption := aktuell^.Tele;
Form1.Label3.Caption := aktuell^.Mail;
boxakk;
end;
procedure zuruck;
var z : Variable;
begin
z:= anker;
while (z<>
nil)
and (z^.next <> aktuell)
do
z := z^.Next;
if z <>
nil then
aktuell := z;
Form1.Label1.Caption := aktuell^.
Name;
Form1.Label2.Caption := aktuell^.Tele;
Form1.Label3.Caption := aktuell^.Mail;
boxakk;
end;
procedure loschen;
var z : Variable;
begin
if aktuell = anker
then
begin
anker:= aktuell^.next;
aktuell := anker;
end
else
begin
z:=anker;
while (z <>
nil)
and (z^.next <> aktuell)
do
z := z^.next;
aktuell := z;
end;
Form1.Label1.Caption := aktuell^.
Name;
Form1.Label2.Caption := aktuell^.Tele;
Form1.Label3.Caption := aktuell^.Mail;
boxakk;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Add;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
vor;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
zuruck;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
loschen;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
suchen;
end;
end.