1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105:
| 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 protected procedure Click; override; public constructor Create (AOwner: TComponent); override; published procedure DeleteRow (RowNumber : Integer); procedure addFile (pfad, dauer, titel: String); 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. |