[Lazarus] Fwd: Need help in streaming components

Kiên Nguyễn Tiến Trung kc97ble at gmail.com
Mon Dec 15 16:34:07 CET 2014


I got it!

Thank all of you very much.

2014-12-15 17:49 GMT+07:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:
>
> On Mon, 15 Dec 2014 07:34:12 -0300
> Glaucos Ginez <glaucosginez at gmail.com> wrote:
>
> > Try TObjectList.
>
> That does not support streaming.
>
>
> >[...]
> > > I want my TClass1 can contain many TClass2. It means that number of
> > > TClass2 in TClass1 is not fixed.
> > >
> > > I've tried to use TComponentList, but it does not work. I knew that
> > > TCollection supports streaming, however, TClass1 and TClass2 must be
> > > TComponent.
>
> The trick is overriding some TComponent methods.
>
> TClass1
>     procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
> TClass2
>     procedure SetParentComponent(Value: TComponent); override;
>     function GetParentComponent: TComponent; override;
>     function HasParent: Boolean; override;
>
> See for example
> lazarus/examples/designnonlcl/mywidgetset.pas
> class TMyWidget
>
>
> Mattias
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141215/c2630f0c/attachment-0003.html>


More information about the Lazarus mailing list