On Tue, 3 Oct 2006, Mattias Gaertner wrote:
> On Mon, 2 Oct 2006 21:58:14 +0200 (CEST)
> Michael Van Canneyt <[EMAIL PROTECTED]> wrote:
>
> >
> >
> > On Mon, 2 Oct 2006, Mattias Gaertner wrote:
> >
> > > Hi all,
> > >
> > > I want to implement visual form inheritance, but there is one
> > > problem, for which I don't see a good solution.
> > >
> > > The situation: Both the ancestor and descendant forms are open in
> > > the IDE.
> > > The Problem: When the ancestor is edited, then the descendants need
> > > to be updated.
> > >
> > > The ancestor can be edited by:
> > > Object Inspector: Here we can add detailed notifications if needed.
> > > Designer: the same.
> > > Anchor Editor: the same.
> > > Some more tools: the same.
> > > Component Editors: These can alter the component in various ways.
> > > They only notify by an unspecific Modified event.
> > > Experts: Same as Component Editors.
> > >
> > > Descendants are loaded by applying first the ancestor values (.lfm)
> > > and then the descendant overrides.
> > >
> > > You can not clear/reset a component. You can only destroy it and
> > > create it again.
> >
> > You don't need to ? You just need to re-read the changed properties.
> >
> > Example:
> > Form1 - Button 1.
> > Form2 - Descendent of Form 1.
> >
> > On Form2 I change the caption of Button 1.
> > I change the location of button 1 on form 1.
> > On form2 the location is also changed to match the location of the
> > button on form1, but the caption remains changed.
> >
> > So all you need to do is to:
> >
> > 1. Stream the parent component (button1 on form1)
>
> Do you mean, after the change of the caption, don't you?
Yes, and after the change of location.
>
> > 2. Apply this stream to the descendent component (button1 on form2).
> > 3. Apply the previous inherited stream to the descendent component.
>
> What do you mean with 'previous inherited stream'?
The stream of the descendent form as it was before point 2.
>
>
> > Or am I missing something ? It's not necessary to stream the whole
> > form ?
>
> The problem are the default values.
> If you change the Form1.Button1.Caption back to the default value, it
> won't be saved to the stream. When this stream is loaded by
> Form2.Button1 the Caption remains unchanged.
> Or am I missing something?
I checked in delphi, and the default value is propagated.
I think that it should be done differently:
- if you change a value of a property in the object inspector,
The IDE should check whether any descendent is open, and apply the
changed value to any inherited components, if the original value
was the same.
So:
- Store current value of property.
- Change value
- for all inherited components in the IDE.
Set property value if original value was the same.
- If you do it through a component editor, there is no alternative but to
scan all properties and apply the changed properties.
The case where the descendent is not opened in the IDE you should not
consider, since then the streaming will take care of it anyway...
Michael.
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives