Link to home
Start Free TrialLog in
Avatar of hoff
hoff

asked on

save object

How save an object in Delphi ?
Avatar of mirek071497
mirek071497

There is no global proc for owner created objects however you can look at the TWriter and TReader.
Generally You must write code to save proprties which is needed for you.
Please tell us more, especially how you need to manipulate the saved objects and what objects you need to save.
You can look at the way Delphi forms are saved. These are basically text files. If you put an image on your form and open a picture in it, when you save the form you'll see how it stores the picture inside the .DFM file.
You can store properties in INI files and inside the rigistry. Use TRegistry or something more inhanced for that. I think it can't store sufisticated objects though. I'm not sure and someone please correct me if I'm wrong.
ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Any descendant of the TPersistent object can use Delphis streaming services. Take a look at the online help of TPersistent. You will have to overwrite the DefineProperties to introduce special data to be read/written, published properties are handled automatically.
However, the easiest way is if your persistent object is contained in a component property. Then call ReadComponent/WriteComponent as viktornet proposed.

Slash/d003303