[Seaside] Magritte

Tony Giaccone tgiaccone at gmail.com
Fri Feb 12 16:02:42 UTC 2010


On Fri, Feb 12, 2010 at 9:43 AM, Richard Durr
<richard.durr at googlemail.com>wrote:

> or
>
> YourClass new asCpmponent addValidatedForm: #( save new cancel).
>
> or
> | actionButtons |
>
> actionButtons := Array
>  with: [ :param | " do something" ] -> 'Label'
>  with: [ :param | " do something different" ] -> 'Another Label'
>  with: [ :param | " do something entirely different" ] -> 'Yet Another
> Label'.
> YourClass new asCpmponent addValidatedForm: actions.
>
>
My current code does this:

component onAnswer: [ :answer | answer isNil ifFalse: [ answer doSave ] ].


I believe that the value of answer is going to be the object being edited.
It's really unclear to me, and this is more of a general smalltalk question,
of what the "context" is in a block like this when it gets executed. And
when I write "context" there, I mean what objects are visible and available
to act on. In C, I'd think of it as the stack frame, but It's not at all
clear to me what "context" refers to in smalltalk.

In your block:
[:param | "do something"] is that code in someway associated with the
context it was declared in? Is the object referenced by actionButtons still
visible and instantiated? Assuming that this whole block of code that you
wrote was a method on MyClass, is the instance of MyClass that handled the
method available to this block?

See I am a total Noob. ;-)


Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100212/09d2ac64/attachment.htm


More information about the seaside mailing list