unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, Grids, StdCtrls, Contnrs;
type
TForm1 =
class(TForm)
MainMenu1: TMainMenu;
Datei1: TMenuItem;
Beenden1: TMenuItem;
Hilfe1: TMenuItem;
Info1: TMenuItem;
ListBox1: TListBox;
StringGrid1: TStringGrid;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Edit4: TEdit;
Label4: TLabel;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Speichern1: TMenuItem;
Speichernals1: TMenuItem;
Beenden2: TMenuItem;
Neu1: TMenuItem;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Button8: TButton;
procedure Info1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Beenden2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
type
TCd =
class(TObject)
interpreter :
string;
albumTitle :
string;
genre :
string;
songTitles : TStringList;
private
procedure setValues(interpreter, albumTitle, genre :
string);
procedure addTitel(songTitles : TStringList);
end;
var
cd : TCd;
cdList : TList;
procedure TForm1.Info1Click(Sender: TObject);
begin
//messageBox();
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//Zeilen benennen
with stringGrid1
do
begin
colWidths[0] := 30;
//Breite der fixen Nr-Spalte verringern
cells[0, 0] := '
Nr.';
cells[1, 0] := '
Interpret';
cells[2, 0] := '
Albumtitel';
cells[3, 0] := '
Genre';
options := [goFixedVertLine, goFixedHorzLine, goHorzLine,
goVertLine, goColSizing];
//goColSizing = Spaltenbreite einstellbar
//goVertLine/goHorzLine = Gitternetz-Linien erscheinen
end;
cdList := TList.create;
//richtig?
cd := TCD.create;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
close;
end;
//Zum Bearbeiten und Erstellen einer CD
procedure TCd.setValues(interpreter, albumTitle, genre :
string);
begin
cd.interpreter := interpreter;
cd.albumTitle := albumTitle;
cd.genre := genre;
end;
//Zum Hinzufügen von Titeln zur aktuellen CD
procedure TCd.addTitel(songTitles : TStringList);
begin
end;
procedure TForm1.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
cd.free;
cdList.free;
end;
//Button "CD hinzufuegen"
procedure TForm1.Button1Click(Sender: TObject);
var s : TStringList;
begin
cd.setValues(edit1.text, edit2.text, edit3.text);
{ s.create;
s.add('a');
cd.songTitles := s;}
cdList.add(cd);
//funktioniert nicht??
stringGrid1.cells[1, 1] := cd.interpreter;
stringGrid1.cells[2, 1] := cd.albumTitle;
stringGrid1.cells[3, 1] := cd.genre;
edit1.text := intToStr(stringGrid1.rowCount);
end;
procedure TForm1.Beenden2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
cd := cdList[0];
//geht nicht??
stringGrid1.cells[1, 3] := cd.interpreter;
stringGrid1.cells[2, 3] := cd.albumTitle;
stringGrid1.cells[3, 3] := cd.genre;
cd := TCD(cdList[1]);
//geht auch nicht??
stringGrid1.cells[1, 4] := cd.interpreter;
stringGrid1.cells[2, 4] := cd.albumTitle;
stringGrid1.cells[3, 4] := cd.genre;
end;
end.