Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

ID: 13364, TStringList descendant that creates/destroys associated objects

by Ceci Gross Email: Anonymous

Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 2.0  to 4.0 521 downloads
Copyright: No significant restrictions

Size: 8,263 bytes
Updated on Sun, 23 May 1999 00:00:00 GMT
Originally uploaded on Sun, 23 May 1999 00:00:00 GMT
SHA1 Hash: 3E7700E6C85F0A7170E21E6E41CB3320A45BCAD7
MD5 Hash: 160DEFB5E3EFE8518E2FBB1FBB4E4FF1

    Explore the files in this upload

TObjStringList works just like TStringList, except that it manages the creation and
freeing of the objects in the associated object list. Includes example project.

The associated objects list in Delphi's TStringList is an extremely useful feature.
When you keep associated object information for your strings, you usually must
create the associated object anywhere in your code that you add or insert a string
to the list. Also you must remember to free the associated object before you remove
a string from the list. Finally you must remember to cycle through your list,
freeing all of the objects, before you actually free the TStringList itself.

With TObjStringList, you simply create and assign a method to TObjStringList's
OnAutoCreateObject event. The OnAutoCreateObject event will take the TObjStringList
object and the index of the newly added string as parameters. Your method is responsible
for creating and returning the object to be associated with the newly added string.
TObjStringList will free the object later, when the string is deleted from the list,
or when the TObjStringList instance itelf is cleared or freed. There is also an OnAutoFreeObject
event which is available for any processing that must be done before an object is freed.

See ObjStrList.pas for code and full description of TObjStringList.
See StringListTest.dpr to excersize the class.

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC04