Mega Code Archive

 
Categories / Delphi / Algorithm Math
 

How to use special lists instead of an array of TComponentTClassTObject

Title: How to use special lists instead of an array of TComponent/TClass/TObject { Just a reminder... ++++++++++++++++++++++++ ENGLISH ++++++++++++++++++++++++++++++++++++++++++++++ Sometime you need to use at run time a list of component/object/class. You may use a static array, a dynamic array or a TList to do the job. Consider to use the "Delphi OOP Way" extended list classes as defined in the unit Contnrs.pas: - TObjectList - TClassList - TComponentList - ... That way, you'll never need to free your components yourself by code when deleting an element from such a list: just add your elements and set the Flag/Property "Owned" to "True"... The List will destroy your component automatically if they are removed from the list.