unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, XPMan, ComCtrls;
type
TForm1 =
class(TForm)
ListView1: TListView;
GroupBox1: TGroupBox;
XPManifest1: TXPManifest;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
GroupBox2: TGroupBox;
BitBtn1: TBitBtn;
Label7: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Label8: TLabel;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure ListView1Click(Sender: TObject);
private
procedure FillList;
procedure OpenInfo;
public
{ Public-Deklarationen }
end;
TMovie =
record
Name :
string[150];
Format :
string[100];
CDs :
string[1];
Ton :
string[20];
Bild :
string[20];
Sprache :
string[20];
Gernre :
string[20];
Kommentar:
string[255];
end;
var
Form1 : TForm1;
datei :
file of TMovie;
data : TMovie;
implementation
{$R *.dfm}
procedure TForm1.FillList;
var
i:Integer;
begin
for i:=0
to sizeof(datei)-1
do begin
Seek(datei, i);
Read(datei, data);
ListView1.Items.Add;
ListView1.Items[i].Caption:=data.
Name;
with ListView1.Items[i].SubItems
do begin
Add(data.Format);
Add(data.Sprache);
end;
end;
end;
procedure TForm1.OpenInfo;
var
i:Integer;
begin
Seek(datei, ListView1.Selected.
Index);
Read(datei, data);
Label1.Caption:=data.
Name;
Label2.Caption:=data.Format;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
AssignFile(datei, '
index.dat');
IF FileExists('
index.dat')
THEN Reset(datei)
else Rewrite(datei);
filllist;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
data.
Name:=Edit1.Text;
data.Format:=Edit2.Text;
data.CDs:=Edit3.Text;
data.Gernre:=Edit4.Text;
data.Bild:=Edit5.Text;
data.Ton:=Edit6.Text;
data.Sprache:=Edit7.Text;
seek(datei, filesize(datei)-1);
write(datei, data);
FillList;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(IntToStr(sizeof(datei)-1));
end;
procedure TForm1.ListView1Click(Sender: TObject);
begin
OpenInfo;
end;
end.