unit playlist;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, StdCtrls, Buttons, ExtCtrls;
type
TInfos =
class
Filename:
string;
public
property Str:
string read Filename
write Filename;
end;
type
TPlayList =
class(TStringGrid)
private
{ Private-Deklarationen }
protected
procedure Click;
override;
{ Protected-Deklarationen }
public
constructor Create (AOwner: TComponent);
override;
{ Public-Deklarationen }
published
procedure DeleteRow (RowNumber : Integer);
procedure addFile (pfad, dauer, titel:
String);
{ Published-Deklarationen }
end;
procedure Register;
implementation
constructor TPlaylist.Create(AOwner: TComponent);
begin
inherited Create (AOwner);
rowcount := 2;
colcount := 3;
fixedcols := 0;
fixedrows := 1;
defaultrowheight := 15;
rowheights[0] := 18;
Cells[0,0] := '
Title';
Cells[1,0] := '
Length';
Cells[2,0] := '
x';
ColWidths[0] := 200;
colwidths[1] := 50;
colwidths[2] := defaultrowheight;
end;
procedure TPlaylist.addFile (pfad, dauer, titel:
String);
var i: Integer;
mo: TInfos;
begin
rowcount := rowcount + 1;
mo:=TInfos.create;
mo.Filename:='
';
Objects[rowcount-1,3]:=mo;
cells[0, rowcount-1] := titel;
cells[1, rowcount-1] := dauer;
cells[2,rowcount-1] := '
x';
cells[3,rowcount-1] := pfad;
end;
procedure Tplaylist.DeleteRow(RowNumber : Integer);
var
i : Integer;
begin
for i := RowNumber
to RowCount - 2
do
Rows[i].Assign(Rows[i+ 1]);
Rows[RowCount-1].Clear;
RowCount := RowCount - 1;
end;
procedure TPlaylist.Click;
begin
if (col = 0)
or (col = 1)
then
selection := TGridRect(Rect(0, row, colcount, row));
if (col = 2)
then
if (row <> 0)
then
deleterow(row);
end;
procedure Register;
begin
RegisterComponents('
Standard', [TPlayList]);
end;
end.