🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.components.writing
Article #24

Re: Streaming a dynamic list of component references

#24
From: Krzysztof Borys (Bask)
Date: Fri, 18 Dec 1998 00:00
37 lines
2150 bytes
On Thu, 17 Dec 1998 13:13:38 GMT, dnote@my-dejanews.com wrote:

>To all Delphi guru's
>
>I want my component to store a list of component references (on the same or
>linked form). To do this the component contains a custom made list class in
>which you can add,  delete and query the component references. This list
>class is derived from TComponent. A pretty silly example of such a component
>could be: a TEdit control which stores the references to multiple TFields in
>order to react to their events.
>
>Example code:
>
>TMyEdit = class(TCustomEdit) private  mFields: TFieldList;  ... published  {
>references are edited through a property editor, the property write specifier
>is  used to allow delphi-form-streaming to take place. }  property Fields:
>TFieldList read mFields write SetFields; end;
>
>TFieldList = class(TComponent)
>private
>  mItems: TList; { of TField }
>  ...
>public
>  procedure Add(aField: TField);
>  ...
>  property Items[aIndex: integer]: TField read GetItems;
>end;
>
>Any suggestions on how to do this (an example DefineProperty, Read and Write
>sheme would be great)?

Try looking into TCollection from Classes unit or TStrings - it can bring some
ideas. Another way is to use TCollection - you must create class which derives
from TCollectionItem and has a property with TComponent type IMHO this could be
better.
UIN:3620584                                            Bask
mailto:bask@kis.p.lodz.pl
Technical Details
Message-ID: <36798c20.608945@posejdon.wpk.p.lodz.pl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <75b021$iib$1@nnrp1.dejanews.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fe2ce,65c39db2a03ef093
X-Google-Attributes: gidfe2ce,public
X-Google-Thread: 112b07,65c39db2a03ef093
X-Google-Attributes: gid112b07,public
From: bask@kis.p.lodz.pl (Krzysztof Borys (Bask))
Subject: Re: Streaming a dynamic list of component references
Date: 1998/12/18
Message-ID: <36798c20.608945@posejdon.wpk.p.lodz.pl>
X-Deja-AN: 423446032
Content-Transfer-Encoding: 7bit
References: <75b021$iib$1@nnrp1.dejanews.com>
Content-Type: text/plain; charset=us-ascii
Organization: Cartall
Mime-Version: 1.0
Newsgroups: comp.lang.pascal.delphi.components.writing,borland.public.delphi.vcl.components.writing