Thema: Delphi TStringList als Property

Einzelnen Beitrag anzeigen

Benutzerbild von Bernhard Geyer
Bernhard Geyer

Registriert seit: 13. Aug 2002
17.171 Beiträge
 
Delphi 10.4 Sydney
 
#2

Re: TStringList als Property

  Alt 29. Mär 2009, 20:19
Glaskugel auspack: Du solltest die Stringliste in deiner Komponente auch anlegen

Delphi-Quellcode:
type
  TMyType = class(TPersistent)
  private
    FMyStringList: TStrings;
  public
    constructor Create(Owner: TObject);
    MyStringList: TStrings read FMyStringList write SetMyStringList;
  end;

constructor TMyType.Create(Owner: TObject);
begin
  inherited

  FMyStringList := TStringList.Create;
end;

procedure SetMyStringList(Value: TStrings);
begin
  FMyStringList.Assign(Value);
end;
Windows Vista - Eine neue Erfahrung in Fehlern.
  Mit Zitat antworten Zitat