Re: [fpc-pascal] Is there a smart way to save/restore NotifyEvents and objects?

2018-02-03 Thread Michael Van Canneyt



On Sat, 3 Feb 2018, Dennis Poon wrote:




If your objects inherit from TComponent and you use published 
properties you can use the streaming screen of the RTL.


I am curious how TComponent save and restore TnotifyEvent fields. Can 
you explain a little bit?


Roughly:

If you put a method in the published section of an object, its name is
written to RTTI. It can be retrieved and set using the RTTi based on the
name: when saving, the name is written to stream, when loading, the name is
looked up in RTTI.

The classes TReader and TWriter in the classes unit perform this work.


Also, what is 'streaming screen' of RTL? How to use it?


He meant the streaming system, I suppose. TComponent, TReader and TWriter
together form the streaming system.

Michel.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Is there a smart way to save/restore NotifyEvents and objects?

2018-02-03 Thread Sven Barth via fpc-pascal
Am 03.02.2018 09:11 schrieb "Michael Van Canneyt" :



On Sat, 3 Feb 2018, Dennis Poon wrote:


>>
>> If your objects inherit from TComponent and you use published properties
>> you can use the streaming screen of the RTL.
>>
>> I am curious how TComponent save and restore TnotifyEvent fields. Can you
> explain a little bit?
>

Roughly:

If you put a method in the published section of an object, its name is
written to RTTI. It can be retrieved and set using the RTTi based on the
name: when saving, the name is written to stream, when loading, the name is
looked up in RTTI.

The classes TReader and TWriter in the classes unit perform this work.


Of course this only works for methods that are published.



Also, what is 'streaming screen' of RTL? How to use it?
>

He meant the streaming system, I suppose. TComponent, TReader and TWriter
together form the streaming system.


Correct. Stupid autocorrection -.-

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Is there a smart way to save/restore NotifyEvents and objects?

2018-02-03 Thread Sven Barth via fpc-pascal
Am 03.02.2018 10:08 schrieb "Michael Van Canneyt" :



On Sat, 3 Feb 2018, Sven Barth via fpc-pascal wrote:

Am 03.02.2018 09:11 schrieb "Michael Van Canneyt" :
>
>
>
> On Sat, 3 Feb 2018, Dennis Poon wrote:
>
>
>
>>> If your objects inherit from TComponent and you use published properties
>>> you can use the streaming screen of the RTL.
>>>
>>> I am curious how TComponent save and restore TnotifyEvent fields. Can you
>>>
>> explain a little bit?
>>
>>
> Roughly:
>
> If you put a method in the published section of an object, its name is
> written to RTTI. It can be retrieved and set using the RTTi based on the
> name: when saving, the name is written to stream, when loading, the name is
> looked up in RTTI.
>
> The classes TReader and TWriter in the classes unit perform this work.
>
>
> Of course this only works for methods that are published.
>

Absolutely, that is why it was the first sentence of my reply :)


Ah right, sorry. It was still before breakfast when I answered that. ^^'



Also, what is 'streaming screen' of RTL? How to use it?
>
>>
>>
> He meant the streaming system, I suppose. TComponent, TReader and TWriter
> together form the streaming system.
>
>
> Correct. Stupid autocorrection -.-
>

Don't you hate it when computers think they're smarter than you ? ;-)


Definitely :P

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Is there a smart way to save/restore NotifyEvents and objects?

2018-02-03 Thread Michael Van Canneyt



On Sat, 3 Feb 2018, Sven Barth via fpc-pascal wrote:


Am 03.02.2018 09:11 schrieb "Michael Van Canneyt" :



On Sat, 3 Feb 2018, Dennis Poon wrote:




If your objects inherit from TComponent and you use published properties
you can use the streaming screen of the RTL.

I am curious how TComponent save and restore TnotifyEvent fields. Can you

explain a little bit?



Roughly:

If you put a method in the published section of an object, its name is
written to RTTI. It can be retrieved and set using the RTTi based on the
name: when saving, the name is written to stream, when loading, the name is
looked up in RTTI.

The classes TReader and TWriter in the classes unit perform this work.


Of course this only works for methods that are published.


Absolutely, that is why it was the first sentence of my reply :)


Also, what is 'streaming screen' of RTL? How to use it?




He meant the streaming system, I suppose. TComponent, TReader and TWriter
together form the streaming system.


Correct. Stupid autocorrection -.-


Don't you hate it when computers think they're smarter than you ? ;-)

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal