Hi,
hoffe das hilft dir.
Delphi-Quellcode:
type
TMyObject = class(TObject)
private
FNAme: String;
public
property Name: String read FName write FName;
end;
type
TMyObjectList = class(TObjectList)
private
function GetItem(ndx: Integer): TMyObject;
procedure SetItem(ndx: Integer; AValue: TMyObject);
public
property items[ndx: Integer]:TMyObject read GetItem write SetItem;
end;
implementation
function TMyObjectList.GetItem(ndx: Integer): TMyObject;
begin
Result := TMyObject(inherited items[ndx]);
end;
procedure TMyObjectList.SetItem(ndx: Integer; AValue: TMyObject);
begin
items[ndx] := AValue;
end;
Mit dem Konstrukt kannst du dann zb sowas machen
Delphi-Quellcode:
procedure irgendwas;
var
aList: TMyObjectList;
begin
aList := TMyOBjectList.Create;
aList.Add(TMyObject.Create);
aList.items[0].Name := 'Hello World';
end;
Grüße