I am using a TObjectList<TCustomFrame> to store TCustomFrames. Now i want to store some more information regarding to the TCustomFrame in the same list. A record would be nice.
Which delphi class would you prefer to store TCustomFrames and records in the same list?
The TCustomFrames and records will be added at runtime.
Create a single record to hold all the information:
Hold that in a
TList<TFrameInfo>.I note that you were using
TObjectList<T>rather thanTList<T>. The only good reason for doing that would be if you were settingOwnsObjectstoTrue. But that seems unlikely since I doubt that the list is really in charge of the lifetime of your GUI objects. As a note for the future, if you find yourself usingTObjectList<T>withOwnsObjectsset toFalsethen you may as well switch toTList<T>.Now, in case you do need the list to control the lifetime then you'd be best using a class rather than a record for
TFrameInfo.And then hold this in a
TObjectList<TFrameInfo>withOwnsObjectsset toTrue.