Re: Data From CREATEOBJECT
- From: Bernhard Sander <fuchs@xxxxxxx>
- Date: Thu, 15 Feb 2007 18:46:12 +0100
Hi Jeff,
For the record, I ended up using a two dimensional array with the object in the first column and the "key" in the second. The array is public (not my favorite way of doing things) so that all of the objects can find it and the main program can find all of the objects.
Why do you use the second column? I think, the object already has a property that stores the key. So there is no need to store it once more in the array.
> The solution is not elegant. There is data in the objects that must be
> preserved when the application isn't running so it is stored in a table
> (that's what databases are for, I think). The elegant solution would be a
> way to store the object pointer in the table when the application is running
> but from that various replies, I guess that isn't really doable. The array
> is working fine, however.
The object pointer is absolutely useless from the moment, when the application ends. At the next run, the object must be newly created and it is quite sure, that its location is very different from the former run of the application. The object is created with the property values from class definition, and these value are most likely different from the values of the former run of the application.
To save and restore the necessary properties just add two methods to your object, one for saving, one for restoring. Good places for calling these methods: in LOAD or INIT of the object call the restore method, in DESTROY or UNLOAD call the save method.
It depends on your needs how to store the values: if there is a fixed scheme which properties to store, you could use a table field for every property. If it is a variable set of properties, then it might be better to build a long string of the property names and the respective values and store this string in a memo field. XML would be a very modern choice for this string.
Regards
Bernhard Sander
.
- Follow-Ups:
- Re: Data From CREATEOBJECT
- From: Jeff Grippe
- Re: Data From CREATEOBJECT
- References:
- Data From CREATEOBJECT
- From: Jeff Grippe
- Re: Data From CREATEOBJECT
- From: Jeff Grippe
- Data From CREATEOBJECT
- Prev by Date: Re: Data From CREATEOBJECT
- Next by Date: Re: Data From CREATEOBJECT
- Previous by thread: Re: Data From CREATEOBJECT
- Next by thread: Re: Data From CREATEOBJECT
- Index(es):
Relevant Pages
|