unit Seite1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls, jpeg, ExtCtrls, Outline, ComCtrls, TabNotBk,
Buttons, iniFiles;
type
TForm1 =
class(TForm)
Hintergrund: TImage;
ueberschrift: TLabel;
eigenschaften: TGroupBox;
ltitel: TLabel;
tinterpret: TLabel;
tgenre: TLabel;
tgroesse: TLabel;
tlaenge: TLabel;
titel: TEdit;
interpret: TEdit;
genre: TEdit;
groesse: TEdit;
laenge: TEdit;
grid: TStringGrid;
operatoren: TGroupBox;
ein: TButton;
BitBtn1: TBitBtn;
spei: TButton;
loeschen: TButton;
laden: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure einClick(Sender: TObject);
procedure speiClick(Sender: TObject);
procedure ladenClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
ini : TiniFile;
implementation
uses Unit2, Seite2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Form3.ShowModal;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
grid.Cells[0,0]:='
Titel';
grid.Cells[1,0]:='
Interpret';
grid.Cells[2,0]:='
Genre';
grid.Cells[3,0]:='
Größe in MB';
grid.Cells[4,0]:='
Länge in min';
end;
procedure TForm1.einClick(Sender: TObject);
var h :integer;
begin
h:=grid.RowCount-1;
grid.Cells[0,h]:=titel.Text;
grid.Cells[1,h]:=interpret.Text;
grid.Cells[2,h]:=genre.Text;
grid.Cells[3,h]:=groesse.Text;
grid.Cells[4,h]:=laenge.Text;
grid.RowCount:=h+2;
titel.SetFocus;
end;
procedure TForm1.speiClick(Sender: TObject);
var a,h : integer;
begin
a:=1;
h:=grid.RowCount-2;
ini := TIniFile.Create(ExtractFilePath( ParamStr(0))+'
data.ini');
ini.EraseSection('
Titel');
for a:=1
to h
do
begin
ini.WriteString('
Titel', IntToStr(a), grid.Cells[0,a])
end;
end;
procedure TForm1.ladenClick(Sender: TObject);
var i : TListBox;
z,a : integer;
sl: TStringlist;
begin
begin
sl := TStringList.Create;
try
Ini.ReadSectionValues('
Titel',sl);
z := sl.Count;
finally
FreeAndNil(sl);
end;
a:=1;
grid.RowCount:=z+1;
for a:=1
to z
do
begin
grid.Cells[0,a]:=ini.ReadString('
Titel', IntToStr(a), '
');
end;
end;
end;
end.