On Wed, 4 Oct 2006 12:24:21 +0200 (CEST)
Michael Van Canneyt <[EMAIL PROTECTED]> wrote:

> 
> 
> 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.

Ah. This is another interesting point. How do you get that?
The descendant stream is created by using an ancestor instance.
So, to create the old stream, you must stream the descendant with an
ancestor instance *after* the descendant was changed and *before* the
ancestor is changed.
At the moment we don't have an event for *before* ancestor is changed.
And it would be quite slow, to stream/save the descendant after every
change.
Hmm. Maybe using a second ancestor instance could solve some problems.

 
> > > 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.

What do you mean with propagated? In the RTTI?
Maybe my term 'default' values was a bad choice, as there is a
'default' property value. I meant the value that is not stored to
the stream. This is defined by the default property value and
the *stored* function. The default value I was talking is the value,
when the component is created. This is not necessarily the default
property value.
Maybe better: 'not stored' value.

 
> 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.

Yes, this could be done for the OI.
And something like that for the anchor editor.
And something more complex for the collection editor.
And something more complex for the designer moving.
But what about the 20 component and property editors that uses special
techniques to alter the component?
And the third party component and property editors?

 
> - If you do it through a component editor, there is no alternative
> but to scan all properties and apply the changed properties.

What about DefineProperties?

 
> 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...

Yes, this thread is only about having both open.


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to