UNIT Literaturliste;
interface
//-------------------- ggf Uses-Liste anpassen ! --------------------
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, mTLiteratur, mListe, msum,
mTLiteraturliste;
//uses mTForm ??
type
TForm1 =
class(TForm)
// published Attribute
BtnHinzufuegen : TButton;
EdAutor : TEdit;
EdISBN : TEdit;
EdJahr : TEdit;
EdOrt : TEdit;
EdTitel : TEdit;
EdVerlag : TEdit;
Label1 : TLabel;
Label2 : TLabel;
Label3 : TLabel;
Label4 : TLabel;
Label5 : TLabel;
Label6 : TLabel;
Memo1 : TMemo;
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
// published Methoden
procedure BtnHinzufuegenClick (Sender: TObject);
// nicht überschreibbar
private //Attribute
hatBuch : TLiteratur;
hatLiteraturliste : TLiteraturliste;
//Objektbeziehungen:
// hatTLiteraturliste : TLiteraturliste;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
//+---------------------------------------------------------------------
//| TForm1: Methodendefinition
//+---------------------------------------------------------------------
//-------- BtnHinzufuegenClick (published) --------------------------------
procedure TForm1.BtnHinzufuegenClick (Sender: TObject);
begin
hatBuch:=TLiteratur.init(edAutor.Text,edTitel.Text,edVerlag.Text,edOrt.Text,edISBN.Text,edJahr.Text);
hatLiteraturliste.ZumEnde;
hatLiteraturliste.haengeAn(hatBuch);
edOrt.Clear;
edAutor.Clear;
edJahr.Clear;
edISBN.Clear;
edTitel.Clear;
edVerlag.Clear;
hatLiteraturliste.anzeigen;
end;
//-------- FormActivate (published) ---------------------------------------
procedure TForm1.FormActivate(Sender: TObject);
begin
hatLiteraturliste:=TLiteraturliste.init;
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
hatLiteraturliste.gibFrei;
end;
end.
-----------------------------
if self.istLeer
then
begin
kenntMemoAnzeige.Lines.Add('
-- leer --')
end
else
begin
while not self.istLeer
do begin
kenntMemoAnzeige.Lines.Add(self.MemoAlsLiteratur.autor+'
'+self.MemoAlsLiteratur.titel+'
'+self.MemoAlsLiteratur.Ort+'
'+self.MemoAlsLiteratur.Jahr+'
'+self.MemoAlsLiteratur.isbn+'
'+self.MemoAlsLiteratur.verlag+'
') ;
//(self.KopfAlsPatient.Name + ' '
lListe.haengeAn(self.MemoAlslIteratur);
lLISTE.haengeAn(self.memoalsliteratur);
self.entferneaktuelles
end;
while not lLiSTE.istLeer
do
begin
self.haengeAn(lListe.MemoAlsLiteratur);
lListe.entferneAKTUELLES ;
end;
lListe.gibfrei;
end;
end;
//-------- lerneMemoKennen (public) ------------------------------------
procedure TLiteraturliste.lerneMemoKennen (pMemo: TMemo);
begin
kenntMemoAnzeige:= pMemo;
end;
//-------- MemoAlsLiteratur (public) -----------------------------------
function TLiteraturliste.MemoAlsLiteratur : TLiteratur;
begin
self.zumAnfang;
result:=TLiteratur(self.aktuelles);
end;
end.
--------------------------
UNIT mTLiteratur;
interface
//-------------------- ggf Uses-Liste einfügen ! --------------------
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TLiteratur =
class
private //Attribute
zAutor :
String;
zISBN :
String;
zJahr :
String;
zOrt :
String;
zTitel :
String;
zVerlag :
String;
public //Methoden
constructor init (pTitel:
String; pAutor:
String; pVerlag:
String; pJahr:
String; pOrt:
String; pISBN:
String);
virtual;
procedure gibFrei;
virtual;
function autor :
String;
virtual;
function isbn :
String;
virtual;
function jahr :
String;
virtual;
function ort :
String;
virtual;
function titel :
String;
virtual;
function verlag :
String;
virtual;
end;
implementation
//+---------------------------------------------------------------------
//| TLiteratur: Methodendefinition
//+---------------------------------------------------------------------
//-------- init (public) -----------------------------------------------
constructor TLiteratur.init (pTitel:
String; pAutor:
String; pVerlag:
String; pJahr:
String; pOrt:
String; pISBN:
String);
begin
zAutor:= pAutor;
zTitel:= pTitel;
zVerlag:= pVerlag;
zJahr:= pJahr;
zOrt:= pOrt;
zISBN:= pISBN;
end;
//-------- gibFrei (public) --------------------------------------------
procedure TLiteratur.gibFrei;
begin
end;
//-------- autor (public) ----------------------------------------------
function TLiteratur.autor :
String;
begin
autor:= zAutor;
end;
//-------- isbn (public) -----------------------------------------------
function TLiteratur.isbn :
String;
begin
isbn:= zISBN;
end;
//-------- jahr (public) -----------------------------------------------
function TLiteratur.jahr :
String;
begin
jahr:= zJahr;
end;
//-------- ort (public) ------------------------------------------------
function TLiteratur.ort :
String;
begin
ort:= zOrt
end;
//-------- titel (public) ----------------------------------------------
function TLiteratur.titel :
String;
begin
titel:= zTitel;
end;
//-------- verlag (public) ---------------------------------------------
function TLiteratur.verlag :
String;
begin
verlag:= zVerlag;
end;
end.
---------------------------
UNIT mTListe;
interface
//-------------------- ggf Uses-Liste einfügen ! --------------------
//uses ....;
type
TListe =
class
end;
implementation
//+---------------------------------------------------------------------
//| TListe: Methodendefinition
//+---------------------------------------------------------------------
end.