[Newbies] How to construct a PolygonMorph?

Bert Freudenberg bert at freudenbergs.de
Tue Dec 22 18:45:41 UTC 2009


On 22.12.2009, at 18:55, Tim Rowe wrote:
> 
> 2009/12/22 Stan Shepherd <stan.shepherd414 at gmail.com>: wrote:
> 
>> And generally, the answers will point you back to the image, rather than
>> documentation.
> 
> Something I'm finding quite frustrating, actually. It feels as if I
> can only do something if I can find somebody else who has done the
> same thing!

Isn't it rather unlikely nobody else ever had to do something similar? And isn't it nice to find that previous code so easily once you know the tools?

> My next step will be to make it respond to a mouse click. I /suspect/
> that's something to do with Morph>>on:send:to: but there's no useful
> documentation in the message definitions and I can't work out what's
> happening in any of the senders (not helped by the fact that browsing
> senders of on:send:to: actually yields senders of all messages whose
> first part ends in "on:", whatever comes before or after, so the first
> result I get is for AlignmentMorph>>addUpDownArrowsFor, because it
> sends a message "position:" to an object).

Hit cmd-g to search for the next occurrence of "on:". This method does employ it, the highlighting is just not smart enough to find the right spot. And it seems to be pretty useful to me:

	upArrow on: #mouseDown send: #upArrowHit to: aMorph

> Surely there comes a point when one needs actual documentation of this
> stuff, instead of tring to work everything out by reverse engineering
> the source?

Not really. We don't feel it is "reverse engineering". We embrace the "open-source-ness" much more than other communities because the relevant source is always at your finger tips. We just browse a big hyper-linked repository of source code (where links are followed by pressing cmd-n or cmd-m). We give methods intention-revealing selectors so there is less needs for comments. When I read the line pasted above I don't think it's worth commenting.

That's not to say there is no need for documentation. But attempts to create comprehensive documentation for Squeak have so far turned out to be unsustainable. 

- Bert -



More information about the Beginners mailing list