[Newbies] Centering text in morphic
lenglish5 at cox.net
Thu Feb 9 16:29:16 UTC 2012
Sure. My first pass at writing code using Morphic is to see if an
existing class does what I want and then deciding if it is worth the
time to "roll my own" using whatever insight I got from seeing how the
existing code works.
#drawOn should only be used if you need to do things which don't use
exisint morphs and/or need a great deal of speed. The built-in
composition capabilities of Morphic are usually powerful enough to
accomplish any kind of behavior using compositions of simpler morphs.
Obviously, you don't create high-level paint programs using morphs as
the pixels, but anything higher level than that is probably a good
candidate for composition.
OTOH, if I was to write an educational program showing how line-drawing
algorithms work, I probably WOULD use morphs as pixels. YMMV.
On 2/9/12 6:40 AM, Johann Hibschman wrote:
> Thanks, that's helpful. I don't think I'm going to use
> SimpleButtonMorph, since it builds in a fixed margin, but reading its
> implementation was useful. It makes a StringMorph and uses its #extent
> to do the centering, and I can just do the same thing. (And I can just
> look at StringMorph's #extent if I need to.) If SimpleButtonMorph
> works by embedding a StringMorph, I think that's a sign that I should
> do that rather than override #drawOn. Johann
> _______________________________________________ Beginners mailing list
> Beginners at lists.squeakfoundation.org
More information about the Beginners