Will ObjectList_Destroy destroy each of the objects contained in the object list?
The contents of an object list will also get destroyed when the object list is destroyed. In general, when you call Destroy() on an object instance, any objects referred to by fields of the object being destroyed will also be destroyed. This is a recursive process. There are two exceptions to this rule. If a field is marked noCopy, or if that field contains a shared object, like an Image or an AddressCard, the object referred to by that field will not get destroyed. (If you call Destroy() directly on a shared object, it will get destroyed, however.)
The entries in an object list are actually part of the extra data for that object instance, but class ObjectList overrides EachExtraField(), which allows it to return entries in the extra data as fields of the object. When Magic Cap is destroying sub-objects, EachExtraField() is called so that objects stored as extra data will be destroyed as well.
To destroy an ObjectList without destroying the objects it contains, you should call ShallowDestroy().
I want to append the contents of an ObjectList in my package to the end of an ObjectList in the system. I tried doing this by making an install entry for my ObjectList, and putting the system ObjectList in the corresponding receiver entry. The problem is that this puts my ObjectList object into the system ObjectList, not the contents of my list. How can I do this?
The problem is that ObjectList_InstallInto simply adds the object to install to the end of the list it currently maintains. What you need to do is create a special object that installs into itself. You would override the InstallInto method for this class, and add your words to the system ObjectList yourself. You can do it like this:
In x.Def:
Define Class ListContentInstaller inherits from ObjectList; overrides InstallInto; End Class;
In Objects.Def:
Instance ObjectList 'Install' 3; length: 1; entry: (ListContentInstaller 7); End Instance; Instance ObjectList 'Receivers' 4; length: 1; entry: (ListContentInstaller 7); End Instance; // This next ObjectList is referred to by the installParameters field of // the SoftwarePackage object. You can specify which system ObjectList you want // to install into here. Instance ObjectList 'Install Parameters' 5; length: 1; entry: iSystemObjectList; // Or whatever End Instance; Instance ListContentInstaller 'Words' 7; length: 3; entry: (Text 119); entry: (Text 120); entry: (Text 122); End Instance;
In x.c:
Method void WordListInstaller_InstallInto(ObjectID self, ObjectID installee, ulong flags, ObjectID parameter, ObjectID packageInstallList) { #pragma unused (installee, flags, packageInstallList) ulong wordsToAdd = Count(self); ulong index; for (index = 1; index <= wordsToAdd; ++index) AddSorted(parameter, At(self, index)); }