[Seaside] Question about Section 12.2 of the Seaside book

Elliot Finley efinley.lists at gmail.com
Sat Oct 23 01:02:31 UTC 2010


On Fri, Oct 22, 2010 at 6:37 PM, John McKeon <p3anoman at gmail.com> wrote:

>
>
> On Fri, Oct 22, 2010 at 8:31 PM, Elliot Finley <efinley.lists at gmail.com>wrote:
>
>> This means the editor needs to operate on a copy of the object.
>>
>
> Yes, and the only place you can put code to deal with the copy is in the
> button callbacks. In this configuration though, answer: is of no use. You
> would need to do something else...
>
>>
>>
>> This is how I did it.  I'm a Smalltalk beginner, so there is probably a
much better way.

 IAddress>>initialize
super initialize.
editor := ContactView new.
self editContact: self contacts first.
editor onAnswer: [ :answer | answer ifTrue: [ self save ] ifFalse: [ self
cancel ] ]

IAddress>>editContact: aContact
contactCurrentlyBeingEdited := aContact.
editor contact: aContact copy.

IAddress>>save
Contact removeContact: contactCurrentlyBeingEdited; addContact: editor
contact

IAddress>>cancel
self editContact: contactCurrentlyBeingEdited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20101022/053489f4/attachment-0001.htm


More information about the seaside mailing list