Re: [fpc-devel] Streaming readonly properties
On Thursday 14 December 2006 08.54, Vincent Snijders wrote: procedure ttestcomp.setsubcomponent(const avalue: ttestsubcomponent); begin fsubcomponent.assign(avalue); end; The problem with this solution, is the write setsubcomponent; part of the declaration. I don't want the users of the LabeledEdit component can change the Label subcomponent. fsubcomponent.assign(avalue); does not change the instance of the subcomponent, it copies some properties from avalue to fsubcomponent if fsubcomponent.assign or avalue.assignto are implemented, otherwise it throws an exception. Martin ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Streaming readonly properties
On Tue, 12 Dec 2006, [EMAIL PROTECTED] wrote: As said in an earlier mail I have problems streaming the property EditLabel: TBoundLabel read FEditLabel; of a TLabeledEdit with fpc 2.1.1. Some discussion on #fpc led to the conclusion that streaming a readonly persistant should be allowed, because you write to the properties of the readonly persistant property. Attached is a proposal to fix it. Delphi does not stream readonly properties. So we won't either. The proper solution for this is support for csSubComponent in TComponent. Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Streaming readonly properties
On Wed, 13 Dec 2006, Vincent Snijders wrote: Michael Van Canneyt schreef: On Tue, 12 Dec 2006, [EMAIL PROTECTED] wrote: As said in an earlier mail I have problems streaming the property EditLabel: TBoundLabel read FEditLabel; of a TLabeledEdit with fpc 2.1.1. Some discussion on #fpc led to the conclusion that streaming a readonly persistant should be allowed, because you write to the properties of the readonly persistant property. Attached is a proposal to fix it. Delphi does not stream readonly properties. So we won't either. The proper solution for this is support for csSubComponent in TComponent. Can you elaborate a bit, what you mean by that? What should be changed and where? Delphi has a ComponentState csSubComponent. This flag should be set if you publish a property of type TComponent, and the TComponent instance is 'owned' by the object that publishes it, i.e. it's NOT a reference to an other existing TComponent. The owned TComponent has 'csSubComponent' in it's componentstyle. This tells delphi to stream the component's properties as part of it's owning component, and not just a reference to it. The IDE will need support for this, as well TComponent and the streaming system. (The latter part is probably the easy part ;) ) Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Streaming readonly properties
Michael Van Canneyt schreef: On Wed, 13 Dec 2006, Vincent Snijders wrote: Michael Van Canneyt schreef: On Tue, 12 Dec 2006, [EMAIL PROTECTED] wrote: As said in an earlier mail I have problems streaming the property EditLabel: TBoundLabel read FEditLabel; of a TLabeledEdit with fpc 2.1.1. Some discussion on #fpc led to the conclusion that streaming a readonly persistant should be allowed, because you write to the properties of the readonly persistant property. Attached is a proposal to fix it. Delphi does not stream readonly properties. So we won't either. The proper solution for this is support for csSubComponent in TComponent. Can you elaborate a bit, what you mean by that? What should be changed and where? Delphi has a ComponentState csSubComponent. This flag should be set if you publish a property of type TComponent, and the TComponent instance is 'owned' by the object that publishes it, i.e. it's NOT a reference to an other existing TComponent. The owned TComponent has 'csSubComponent' in it's componentstyle. This tells delphi to stream the component's properties as part of it's owning component, and not just a reference to it. The IDE will need support for this, as well TComponent and the streaming system. (The latter part is probably the easy part ;) ) So far so good. The IDE supports this (no drop downbox in the IO, but you can expand to set the owned component's properties). The owned component has the csSubComponent in its component style: Include(FEditLabel.ComponentStyle, csSubComponent); Include(FEditLabel.ControlStyle, csNoDesignSelectable); So where should the streaming occur? Should I amend to patch to allow streaming properties of readonly subcomponents? Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Streaming readonly properties
On Wed, 13 Dec 2006, Vincent Snijders wrote: Michael Van Canneyt schreef: On Wed, 13 Dec 2006, Vincent Snijders wrote: Michael Van Canneyt schreef: On Tue, 12 Dec 2006, [EMAIL PROTECTED] wrote: As said in an earlier mail I have problems streaming the property EditLabel: TBoundLabel read FEditLabel; of a TLabeledEdit with fpc 2.1.1. Some discussion on #fpc led to the conclusion that streaming a readonly persistant should be allowed, because you write to the properties of the readonly persistant property. Attached is a proposal to fix it. Delphi does not stream readonly properties. So we won't either. The proper solution for this is support for csSubComponent in TComponent. Can you elaborate a bit, what you mean by that? What should be changed and where? Delphi has a ComponentState csSubComponent. This flag should be set if you publish a property of type TComponent, and the TComponent instance is 'owned' by the object that publishes it, i.e. it's NOT a reference to an other existing TComponent. The owned TComponent has 'csSubComponent' in it's componentstyle. This tells delphi to stream the component's properties as part of it's owning component, and not just a reference to it. The IDE will need support for this, as well TComponent and the streaming system. (The latter part is probably the easy part ;) ) So far so good. The IDE supports this (no drop downbox in the IO, but you can expand to set the owned component's properties). The owned component has the csSubComponent in its component style: Include(FEditLabel.ComponentStyle, csSubComponent); Include(FEditLabel.ControlStyle, csNoDesignSelectable); So where should the streaming occur? When EditLabel is encountered ? Should I amend to patch to allow streaming properties of readonly subcomponents? Yes, please do. It should be quite like the check you made before... Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Streaming readonly properties
Michael Van Canneyt schreef: On Wed, 13 Dec 2006, Vincent Snijders wrote: Michael Van Canneyt schreef: On Wed, 13 Dec 2006, Vincent Snijders wrote: Michael Van Canneyt schreef: On Tue, 12 Dec 2006, [EMAIL PROTECTED] wrote: As said in an earlier mail I have problems streaming the property EditLabel: TBoundLabel read FEditLabel; of a TLabeledEdit with fpc 2.1.1. Some discussion on #fpc led to the conclusion that streaming a readonly persistant should be allowed, because you write to the properties of the readonly persistant property. Attached is a proposal to fix it. Delphi does not stream readonly properties. So we won't either. The proper solution for this is support for csSubComponent in TComponent. Can you elaborate a bit, what you mean by that? What should be changed and where? Delphi has a ComponentState csSubComponent. This flag should be set if you publish a property of type TComponent, and the TComponent instance is 'owned' by the object that publishes it, i.e. it's NOT a reference to an other existing TComponent. The owned TComponent has 'csSubComponent' in it's componentstyle. This tells delphi to stream the component's properties as part of it's owning component, and not just a reference to it. The IDE will need support for this, as well TComponent and the streaming system. (The latter part is probably the easy part ;) ) So far so good. The IDE supports this (no drop downbox in the IO, but you can expand to set the owned component's properties). The owned component has the csSubComponent in its component style: Include(FEditLabel.ComponentStyle, csSubComponent); Include(FEditLabel.ControlStyle, csNoDesignSelectable); So where should the streaming occur? When EditLabel is encountered ? I am not sure I understand your question. EditLabel is a published property of TLabeledEdit. Should I amend to patch to allow streaming properties of readonly subcomponents? Yes, please do. It should be quite like the check you made before... I will try. Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Streaming readonly properties
On Tuesday 12 December 2006 14.54, [EMAIL PROTECTED] wrote: As said in an earlier mail I have problems streaming the property EditLabel: TBoundLabel read FEditLabel; of a TLabeledEdit with fpc 2.1.1. A usual solution: ttestcomp = class(tcomponent) private fsubcomponent: ttestsubcomponent; procedure setsubcomponent(const avalue: ttestsubcomponent); //... published property subcomponent: ttestsubcomponent read fsubcomponent write setsubcomponent; end; implementation procedure ttestcomp.setsubcomponent(const avalue: ttestsubcomponent); begin fsubcomponent.assign(avalue); end; Martin ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Streaming readonly properties
Martin Schreiber schreef: On Tuesday 12 December 2006 14.54, [EMAIL PROTECTED] wrote: As said in an earlier mail I have problems streaming the property EditLabel: TBoundLabel read FEditLabel; of a TLabeledEdit with fpc 2.1.1. A usual solution: ttestcomp = class(tcomponent) private fsubcomponent: ttestsubcomponent; procedure setsubcomponent(const avalue: ttestsubcomponent); //... published property subcomponent: ttestsubcomponent read fsubcomponent write setsubcomponent; end; implementation procedure ttestcomp.setsubcomponent(const avalue: ttestsubcomponent); begin fsubcomponent.assign(avalue); end; The problem with this solution, is the write setsubcomponent; part of the declaration. I don't want the users of the LabeledEdit component can change the Label subcomponent. Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] streaming readonly properties
Aleš Katona schreef: Hi, I recently changed TReader and TWriter to be delphi compatible (they were missing a virtual read and a virtual write. It might be related, best idea is to see if all TWriter/TReader descendants which add read and write have them use override. As for the concrete problem.. not sure if it's truly related or not bug I guess RTTI did change. No, your changes are made after the bug report, so they are not the cause of the bug, at most the cause the problem I see now, but not likely. PS: I did fix TDelphiReader and TDelphiWriter to override but didn't find any other direct descendants in RTL/FCL/LCL by grep (I admit it's not the way to search for them). The TLRSObjectReader inherits from TAbstractObjectReader and has a procedure Read(var Buf; Count: LongInt); Would that be affected by your patch? Vincent ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel