I have a TObjectlist of objects (A)s that in turn have a set of related objects (B)(the number of (B)s varies for each A).
I know that I can use a property array for the (B)s but would prefer to use the built in methods etc. of TObjectlist to control the varying lists of (B)s.
Is there any disadvantage?
Can I obtain a (B) object (not the Blist) from the (A)object by using a property of the (A) object to do the indexing and then type cast internally, then present the (B) object as the result. Like two jobs in one.
At present I can only use read to return the complete (B) list as a result and then externally index and type cast to obtain the individual (B) object.
i.e.
TBlist: Class (Tobjectlist)
The following is an object in list (A)
Private
FMyList: TBlist
published
property MyList[index: integer]: TStrip read GetMyList write SetMyList
The message I get is that I cannot declare the property as an array, because I am trying to get one item from the list instead of the whole list as follows (which does work);
property Mylist: TAlist read FMyList write SetMyList;
I hope this is clear!!
Thanks
I know that I can use a property array for the (B)s but would prefer to use the built in methods etc. of TObjectlist to control the varying lists of (B)s.
Is there any disadvantage?
Can I obtain a (B) object (not the Blist) from the (A)object by using a property of the (A) object to do the indexing and then type cast internally, then present the (B) object as the result. Like two jobs in one.
At present I can only use read to return the complete (B) list as a result and then externally index and type cast to obtain the individual (B) object.
i.e.
TBlist: Class (Tobjectlist)
The following is an object in list (A)
Private
FMyList: TBlist
published
property MyList[index: integer]: TStrip read GetMyList write SetMyList
The message I get is that I cannot declare the property as an array, because I am trying to get one item from the list instead of the whole list as follows (which does work);
property Mylist: TAlist read FMyList write SetMyList;
I hope this is clear!!
Thanks