Dear David,
It's *EXACTLY* what i needed.
Thank you very much !
By the way, anyone got an idea why if the line "Transcript show: (pos asString);cr." is commented out or the Transcript Window is closed, i don't get the animation but only the final state of the animation ? (see code belows).
Thank you !
|m1 m2|
m1:=Morph new.
m1 extent:800@600.
m1 color:Color blue.
m1 center: Display center.
m1 openInWorld.
m1 clipSubmorphs:true.
m2:=Morph new.
m2 extent:200@200.
m2 color:Color red.
m1 addMorph: m2.
m2 center: m1 center.
1 to:200 do:[:el|
|pos|
(Duration seconds:0.01) asDelay wait.
pos:=(m2 position x -5)@(m2 position y).
((pos x + m2 width) >= (m1 position x)) ifFalse:[
pos:=((m1 position x + m1 width)@ m2 position y).
].
"Transcript show: (pos asString);cr."
m2 position:pos.
].
2012/7/19
<beginners-request@lists.squeakfoundation.org>
Send Beginners mailing list submissions to
beginners@lists.squeakfoundation.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.squeakfoundation.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
beginners-request@lists.squeakfoundation.org
You can reach the person managing the list at
beginners-owner@lists.squeakfoundation.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Morphic - how to make a submorph not visible outside his
owner ? (David Corking)
2. Re: Morphic - how to make a submorph not visible outside his
owner ? (David Corking)
----------------------------------------------------------------------
Message: 1
Date: Wed, 18 Jul 2012 15:02:25 +0100
From: David Corking <lists@dcorking.com>
Subject: Re: [Newbies] Morphic - how to make a submorph not visible
outside his owner ?
To: "A friendly place to get answers to even the most basic questions
about Squeak." <beginners@lists.squeakfoundation.org>
Message-ID:
<CAG+Z5Jc8rM_7-toVpRYmhjG2cfXfR10+ivitvFHkm4U4SKbwkQ@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Patrick, Is clipSubmorphs what you want?
David
------------------------------
Message: 2
Date: Wed, 18 Jul 2012 16:23:07 +0100
From: David Corking <lists@dcorking.com>
Subject: Re: [Newbies] Morphic - how to make a submorph not visible
outside his owner ?
To: "A friendly place to get answers to even the most basic questions
about Squeak." <beginners@lists.squeakfoundation.org>
Message-ID:
<CAG+Z5JcYzXFMzeJnQhd63m4RF+=k9uz_V2SMfL=hUVsq5FX50g@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
I should be more specific. Try
m1 clipSubmorphs: true.
Hope that helps. David
p.s. I think your do loop pre-empts the Morphic UI loop.
Have you read John Maloney's tutorial on the step method?
http://stephane.ducasse.free.fr/FreeBooks/CollectiveNBlueBook/morphic.final.pdf
In the meantime, you could switch your Transcript hack for this hack :)
m1 refreshWorld.
------------------------------
_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 75, Issue 9
****************************************