On 05/08/2015 11:14, Norbert Hartl wrote:
Am 05.08.2015 um 10:58 schrieb Iwan Vosloo
<iwan(a)reahl.org
<mailto:iwan@reahl.org>>:
Thanks, Norbert. I get that, but when you do, for example:
aComponent := anObject asComponent.
then aComponent holds onto the description created above (in
asComponent's implementation), as I understand it.
This means that as long as aComponent exists, it will always refer to
the same description.
Is that understanding correct?
I think that is correct. I don't use magritte much lately so my memory
is slightly blurry. I need to give a more precise answer to the
instance side description. A description can alter in two ways. Either
the shape/class of the description changes when accessed multiple
times. I think this is a not so likely thing to happen. The other way
would be if the data in the description changes because the object
changed. So a multiple option description can update the list of
options while the descriptions stay the same. And that is one thing
you gain with Magritte3 because you can have descriptions with dynamic
data that has access to the instance.
Thanks Norbert, I have to ask stupid questions because I realise I am
sometimes struggling for lack of understanding some fundamental concepts.
I think I understand how some of the data displayed by a component can
change during the lifetime of the component. For example, a
MAElementDescriptionComponent>>value will just use the accessor set on
the description, so that is quite dynamic. But what I am struggling with
is things like setting visibility of a description. For example I could
have the following on the instance side of my object:
descriptionNumber
^ MANumberDescription new
selectorAccessor: #number;
visible: self mayBeSeen;
yourself
... with the assumption that mayBeSeen is a method on my object that
might return a different result during the lifetime of aComponent in my
example above.
But it seems that visible: can only take a Boolean, which the
description then retains for the lifetime of the description. The
description in turn lives as long as the MAContainerComponent stays
alive. So, I don't really understand how one can change the contents of
the MAContainerComponent based on something like visible: on the
description. (I thought magritteDynamicObject could help here, but
magritteDynamicObject is deprecated in Magritte3.)
Regards
- Iwan
--
Reahl, the Python only web framework:
http://www.reahl.org