[Newbies] Re: How to reopen a collapsed Morph from another Morph?
Mateusz Grotek
unoduetre at poczta.onet.pl
Sat Aug 15 22:03:54 UTC 2015
Dnia 14.08.2015 10:58:52, Fredrik Alink napisał(a):
> Mateusz Grotek wrote
> > .......
> > collapse
> > CollapsedMorph new beReplacementFor: self
> > .......
> > |morph collapsedMorph|
> > morph := Morph new.
> > "collapse it"
> > collapsedMorph := morph collapse.
> > "uncollapse it"
> > collapsedMorph collapseOrExpand.
> > .......
>
> That will turn my morphA into a CollapsedMorph, where originally it
> is a
> subclass of a subclass of Morph, thus loosing morphA"s behaviour.
>
>
Your original morph is still referenced by the variable morph in the
code above. collapsedMorph is a CollapsedMorph instance. You just need
to keep it until you want to expand it. After expanding you throw it
away.
| originalMorph collapsedMorph |
originalMorph := yourMorph. "Your original morph is always here. It
doesn't turn into a CollapsedMorph."
...
...
...
collapsedMorph := morph collapse. "This is the CollapsedMorph. You
need to keep it only until expanding."
...
... "You can still use your original Morph available in the variable
originalMorph here."
...
collapsedMorph collapseOrExpand. "Expanding it. Now you can ignore
the collapsedMorph variable."
...
More information about the Beginners
mailing list