TPersistent is the ancestor for all objects that have assignment and streaming capabilities. It is defined in the Classes.pas unit.
Questions tagged [tpersistent]
16 questions
6
votes
1 answer
Runtime design - storing and loading form layout (recursively?)
I'm creating an application which layout needs to be fully configurable on client-side. It means each component (control) can be resized and moved around the form, new controls can be added, or some removed.
I'd like to use JVCL Runtime Design…

migajek
- 8,524
- 15
- 77
- 116
6
votes
1 answer
Ignore unknown properties when reading object from stream
We have an application that stores project information in a file by descending from TPersistent. We use TSteam.ReadComponentRes to read from a stream to the object.
We would like to be able to open project files with unknown properties (from newer…

boileau
- 817
- 6
- 20
5
votes
1 answer
Writing C++ Builder/Delphi component and save a binary property to DFM files
I wrote a C++ builder component to display SVG files perform some stuff on them.
For now, I published a property named SvgFile (UnicodeString) which can be initialized in the IDE with the file name of the SVG file. This works fine. This property is…

A.G.
- 1,279
- 1
- 11
- 28
3
votes
2 answers
Save/Load TObject(TPersistent) to XML
everybody.
I'm trying to save my class:
TA= class(TPersistent)
private
FItems: TObjectList;
FOnChanged: TNotifyEvent;
public
constructor Create;
destructor Destroy; override;
...
procedure Delete(Index: Integer);
…

Keeper
- 457
- 4
- 14
3
votes
1 answer
Can I serialize a Delphi TPersistent as a field of TComponent using the default WriteComponent action?
I'm getting very confused about how to write out properties from a TComponent that has a TPersistent field. For example I have:
TChildObj = class( TPersistent )
PRIVATE
FVisible: boolean;
FColor: TColor;
PUBLIC
PUBLISHED
property…

Brian Frost
- 13,334
- 11
- 80
- 154
2
votes
1 answer
Collection editor does not open for a TCollection property in a TPersistent property
I've got my custom collection property which is working great when it is a direct member of my component.
But I want to move the collection property to a TPersistent propery within my component. And now comes the problem, it doesn't work: double…

JustMe
- 2,329
- 3
- 23
- 43
2
votes
2 answers
Best way to implement Clone() in my specific classes
In my specific TPersistent classes I'd like to provide a Clone function, which returns an independent copy of the object.
Is it possible to make this work correctly with descendants, without implementing the Clone function in each and every…

maf-soft
- 2,335
- 3
- 26
- 49
2
votes
1 answer
TPersistent + interface, Delphi
I need a class that is based on TPersistent (so it stores the RTTI) and includes default Interfaces handling (QueryInterface, _AddRef, _Release) ... what is the class name I'm looking for?

migajek
- 8,524
- 15
- 77
- 116
1
vote
1 answer
Collection Indexing Strategy
I have a collection of TPersistent objects. I want to index them by their memory location (as main index) and by their properties (using rtti). A collection may have several property based indexes (based on different properties).
What is the…

Luthfi
- 432
- 2
- 5
- 13
1
vote
3 answers
Delphi Streaming Problem
I'm using a blob field in a kbmMemTable to store a custom component that I've developed from TComponent and I use the read and write component stream methods of the TReader to read and write the component to the blob field. The data in the…

golfur
- 11
- 2
1
vote
1 answer
Delphi - Custom thread not being created
i'm having a bit of a problem here. I have a custom class that inherits TPersistent class, inside(private section) this custom class, i have a custom made TThread with overriden Execute method which fires every (1000 ms). Everything works great,…

Ironcross
- 33
- 4
1
vote
0 answers
Persisting more than one object in Delphi 7
This is not a duplicate but a follow-up to "Persistent Objects in Windows XP/Delphi 7."
I need to persist more than one object in Delphi 7, and the objects are a class family. RRUZ's answer suggests I inherit from TPersistent and use…

DelphiProgrammer
- 269
- 6
- 11
1
vote
1 answer
TColumn.FieldName property editor
I'm analyzing the DBGrids.pas unit. There's a TColumn class which have published the FieldName property
property FieldName: String read FFieldName write SetFieldName;
It's declared as a string but in the object inspector it's appear as a editable…

JustMe
- 2,329
- 3
- 23
- 43
0
votes
0 answers
TPersistent component in a TCollectionItem / Access a TCollectionItem property from a TPersistent
Please take a look to the bellow code part of a TComponent:
TMyField = class(TCollectionItem)
private
FName: String
FSqlField: TSqlField;
procedure SetName(const Value: String);
procedure SetSqlField(const Value: TSqlField)
published
…

REALSOFO
- 852
- 9
- 37
0
votes
2 answers
How can a Delphi TForm / TPersistent object calculate its own construction and deserialization time?
For performance tests I need a way to measure the time needed for a form to load its definition from the DFM. All existing forms inherit a custom form class.
To capture the current time, this base class needs overriden methods as "extension…

mjn
- 36,362
- 28
- 176
- 378