[Newbies] Generating subMorphs with relative coordinates

Nicola Mingotti nmingotti at gmail.com
Thu Oct 31 20:52:53 UTC 2019


Hi Christian,

Try this snippet, I think it is self explanatory.

-----------
tr := TransformMorph new.
tr openInWorld.
tr bounds: (100 at 100 corner: 300 at 300).

c1 := CircleMorph new.
tr addMorph: c1.
c1 position." 0 at 0"
c1 center: 0 at 0.
-----------

bye
Nicola




> On Oct 31, 2019, at 7:31 AM, Christian Kellermann <ckeen at pestilenz.org> wrote:
> 
> Dear List,
> 
> I would like to generate Morphs inside another parent Morph.
> In this case a bunch of CircleMorphs inside a RectangleMorph.
> 
> ATM I am generating them first and then adding them as a whole with
> a OrderedCollection and addAllMorphs:
> 
> Now during creating of the circles I am adding the world offset of
> the Rectangle morph to their bounds:
> 
> Is there a way to use relative coordinates for everything and have
> the system place the Morphs accordingly?
> 
> So far I have found addMorphFrontFromWorldPosition: but that seems
> a bit awkward to use in this case.
> 
> How do you deal with this situation usually?
> 
> Thanks and kind regards,
> 
> Christian
> 
> 
> -- 
> May you be peaceful, may you live in safety, may you be free from
> suffering, and may you live with ease.
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners



More information about the Beginners mailing list