[Newbies] Passing methods to buttons

Filip Malczak filet00 at gmail.com
Wed Jan 14 18:33:03 UTC 2009

While trying to understand SnakeGame I found interesting thing, but Im not
sure how does it exactly work.

Does ButtonMorph #actionSelector: aSymbol gives a method to do when
red-clicking? I mean:

SimpleButtonMorph new label: 'Label';
             color: Color lightGray;
             borderColor: #raised;
             borderWidth: 2;
             actionSelector: #delete;
             target: self);

will after clicking send message #delete to self? So when e.g. I give
actionSelector: #openWindow; target: SuperMorph , I mean that after clicking
this message openWindow will be sent to SuperMorph? (I give just an example,
not real code)

So what about blue and yellow buttons? How to handle them from code-level?

I understand that I must have #aSymbol, #delete or #openWindow declared. But
for what class? This, in which method I use upper code (when I create
SimpleButton) or targets class?

Propably I got it all wrong, so if anyone can explain me how to create
button and give a special action for clicking (any button, not only red)
from code level, I'd be VERY pleased.

GG: 2486889
mail: filet00 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20090114/2a0c91c9/attachment.htm

More information about the Beginners mailing list