Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

Property Editor For A List of Obects (eg. items)

I am trying to write a property editor for a list of Items
these items are of type TMyObject (custom class)

At design time I click the elipses and edit the property
but the items I added at design time are cleared at
run time.

how do I place them on the stream...?

Is is possible to get example code ?

Thanx in advance
"Beta" aKa "Zero 1"
0
Brendan040397
Asked:
Brendan040397
  • 3
1 Solution
 
mheacockCommented:
Not for 20 points.
0
 
Brendan040397Author Commented:
Sorrry I am not used to this point system thing
I rate the question Easy... but hey ...
0
 
addictCommented:
> how do I place them on the stream...?

You must write a wrapper list object around your object that decends from TPersistent.  TPersistent is the object that allows saving to a stream.  Then override the DefineProperties method to  define what you want to save to the stream.

  TLList = class(TPersistent)
  protected
    FList     :TList;
    procedure WriteData( Writer:TWriter );
    procedure ReadData( Reader:TReader );
    procedure DefineProperties( Filer:TFiler ); override;
  public
    constructor Create;
    destructor  Destroy; override;
    property    List:TList read FList write FList;
  end;

procedure TLList.DefineProperties( Filer:TFiler );
begin
  inherited DefineProperties( Filer );
  Filer.DefineProperty('LST', ReadData, WriteData, true );
end;


Michael Novak
Addictive Software
addict@flinthills.com
http://www.flinthills.com/~addict/

0
 
Brendan040397Author Commented:
This is my first venture into TPersistant.. etc

What will the ReadData and WriteData Procedures
Look like.?


0
 
Brendan040397Author Commented:
Thanx I'll take a look @ that
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now