[Newbies] Subclassing PasteUpMorph

Michael Rice limitcase at gmail.com
Wed May 4 17:48:39 UTC 2016


I'm experimenting with subclassing PasteUpMorph to get some additional
behavior. One thing I want to do is have my subclass open with a
CircleMorph at 0 at 0. I already get that behavior, the CircleMorph in the
upper left corner, but want my subclass' origin to be at its center, and
the CircleMorph drawn there. My current initialize method,

initialize
""

super initialize.
self originAtCenter; addMorph: ((CircleMorph new) color: Color white)
centeredNear: 0 at 0.

still places it in the upper left corner.

How do I get the origin, 0 at 0, at the center?

My only other method, so far, sets my subclass default bounds.

defaultBounds
"answer the default bounds for the receiver"
^ 0 @ 0 corner: 400 @ 400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20160504/59994a8c/attachment-0001.htm


More information about the Beginners mailing list