[fpc-devel] Streaming readonly properties

Michael Van Canneyt michael at freepascal.org
Wed Dec 13 23:27:55 CET 2006



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 Wed, 13 Dec 2006, Vincent Snijders wrote:
> > > >
> > > > > Michael Van Canneyt schreef:
> > > > > > On Tue, 12 Dec 2006, vsnijders at quicknet.nl 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.

I know that, but it was not a question, so read as

"When EditLabel is encountered."

:-)

When you do the streaming, I assume you'll have to set some
extra flag in the stream, probably you'll need to check Delphi 
streaming code for the value of this flag... (but I'm not sure)

Michael.



More information about the fpc-devel mailing list