AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Installation einer Komponente

Ein Thema von smepal · begonnen am 20. Aug 2006 · letzter Beitrag vom 21. Aug 2006
 
Benutzerbild von smepal
smepal

Registriert seit: 25. Okt 2005
Ort: Bechen
58 Beiträge
 
Delphi 2005 Personal
 
#1

Installation einer Komponente

  Alt 20. Aug 2006, 16:17
Also ich hab da ein Problem:
Ich habe mir eine Komponente geschrieben:
Delphi-Quellcode:
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
 TTracks = record
  Title: String;
  time: String;
  path: String;
  no: Integer;
 end;




type
  TPlayList = class(TStringGrid)

  private
    function GetTracks(index:integer):TTracks; { Private-Deklarationen }
  protected

    { Protected-Deklarationen }
  public
  constructor Create (AOwner: TComponent); override;
  Procedure KeyDown(var Key: Word; Shift: TShiftState); override;
    { Public-Deklarationen }


  published
   procedure DeleteRow (RowNumber : Integer);
   procedure addFile (pfad, dauer, titel: String);
   procedure openM3u (m3u: String);
   procedure savem3u (m3u: String);
   property Track[index:integer]:TTracks read GetTracks;
   { Published-Deklarationen }
  end;

procedure Register;



implementation

constructor TPlaylist.Create(AOwner: TComponent);
var option: TGridOptions;
begin
inherited Create (AOwner);
options := [gorowselect] + [gocolsizing]+ [gofixedvertline] + [gofixedhorzline] + [govertline] + [gohorzline];

rowcount := 2;
 colcount := 3;
 fixedcols := 0;
 fixedrows := 1;
 defaultrowheight := 15;
 rowheights[0] := 18;
Cells[1,0] := 'Title';
Cells[2,0] := 'Length';
Cells[0,0] := 'No';
ColWidths[0] := 30;
colwidths[1] := 200;
colwidths[2] := 50;


end;

function TPlaylist.GetTracks (index: Integer): TTracks;
begin
Result.no := strtoint(cells[0, index]);
Result.Title:= cells[1, index];
  Result.time := cells[2, index];
  Result.path := cells[3, index];

end;

procedure TPlaylist.savem3u(m3u: String);
var i: Integer;
list: TStringlist;
begin
list := TStringlist.Create;
list.Add('#EXTM3U');
for i := 1 to rowcount-1 do
begin
list.Add('#EXTINF:'+cells[2,i]+','+ cells[1,i]);
list.Add(cells[3,i]);
end;
list.SaveToFile(m3u);
list.Free;
end;


procedure TPlaylist.openM3u (m3u: String);
var i, position: Integer;
 list: Tstringlist;
 path, time, title: String;
begin
list := TStringlist.Create;
list.LoadFromFile(m3u);

if list.Strings[0] = '#EXTM3Uthen
   begin
      for i := 0 to list.Count - 1 do
        begin
        position := ansipos ('#EXTINF:' , list.Strings[i]);
                 if position = 1 then
                 begin
                 time := copy(list.strings[i],9,3);
                 title := copy(list.strings[i],13,1000);
                 path := list.Strings[i+1];
                 addfile(path,time,title);
                 end;
        end;
end;
end;

procedure TPlaylist.addFile (pfad, dauer, titel: String);
var i: Integer;
mo: TInfos;
begin
rowcount := rowcount + 1;




mo:=TInfos.create;
    mo.Filename:='';
    Objects[rowcount-2,3]:=mo;


cells[1, rowcount-2] := titel;
cells[2, rowcount-2] := dauer;
cells[0,rowcount-2] := inttostr(rowcount - 2);
cells[3,rowcount-2] := 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;
 for i := 1 to rowcount do
 cells[0,i] := inttostr(i);
end;

procedure TPlaylist.KeyDown(var Key: Word; Shift: TShiftState);
begin
if key = vk_delete then
   if (row <> 0) then
      deleterow(row);
end;

procedure Register;
begin
  RegisterComponents('Standard', [TPlayList]);
end;




end.
Bei Delphi 3 kann ich sie ohne Probleme installieren und verwenden!
Bei Delphi 2005 PE meckert er bei dieser Zeile:

property Track[index:integer]:TTracks read GetTracks;
Zitat:
[Fehler] playlist.pas(45): E2188 Published-Eigenschaft 'Track' kann nicht vom Typ ARRAY sein

Ich krieg das einfach nicht hin!
Martin Krämer
Be water my friend!!!
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:22 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz