[etoys-dev] How can I embed an object in another "holder"

Bert Freudenberg bert at freudenbergs.de
Mon Jan 28 07:06:20 EST 2013

On 2013-01-28, at 07:31, Steve Thomas <sthomas1 at gosargon.com> wrote:

> Thanks Subbu.
> I started looking at what you sent and poking around trying to figure out the code, then realized I could do it "the Etoys way" and put the morph back into its previous holder (which can vary and I store in a player variable).
> I wound up using a playfield include tile and replacing playfield with the variable used to store the original holder:
> 	self getOrigHolder include: self.
> Stephen

Yep, that's the right way to do it in Etoys. In addition to moving the object, it also ensures it's in view, the holder's cursor gets updated etc.

If you were doing it in plain Morphic, you would do something like

	newContainer addMorph: self

which automatically deletes self from its current container, but does not change the position etc.

- Bert -

More information about the etoys-dev mailing list