tb=class(TCollectionItem)//must be Tcollectionitem
private
Fc: Tc;
procedure Setc(Value: Tc);
protected
function GetDisplayName: string; override;//need override
procedure SetIndex(Value: Integer); override;//must override
public
constructor Create(Collection: TCollection); override;//must
destructor Destroy; override;//must
procedure Assign(Source: TPersistent); override;//must
published
property c: Tc read Fc write Setc ;
end;
Tbs = class(TCollection)//must be Tcollection
private
FOwner: Ta;
function GetItem(Index: Integer): Tb;
procedure SetItem(Index: Integer; Value: Tb);
procedure Updatebs;
protected
function GetOwner: TPersistent; override;
procedure Update(Item: TCollectionItem); override;
public
constructor Create(AOwner: Ta);
function Add: Tb;
property Owner: Ta read FOwner;
property Items[Index: Integer]: Tb read GetItem write SetItem; ;
end;
ta=class(twincontrol)
private
fbs:tbs;
public
property bs[Index: Integer]: Tb read GetbFromIndex;
published
property bs: Tbs read Fbs write Setbs;
end;
then you can use a.bs[0].c
最好详细看一下tcustomlistview的source.