Following chapter 12.2 and encountering difficulties with my interpretation of

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Following chapter 12.2 and encountering difficulties with my interpretation of

Intrader Intrader
chapter 11.5 handling of the Cancel button.
1. A first try at following 11.5 fails when a second click on the Cancel button
results in "Error: Object is not in the collection.";  I am deleting aContact a
 second time. The copy is indeed added to the collection but it does not
replace the collection entry corresponding to where aContact was obtained.
2. Further the editor subcomponent does not revert to its original state.
3. The list component is not updated when the contact name is changed.
It appears that the callback containing the editor reference should be updated.
A possible solution would be to deep copy the copy reference back into the
aContact reference and do not remove the aContact entry.

I need help in understanding how to properly handle Cancel when embedded
components are involved.
The code I have in the editContact method is
<code>
editContact: aContact
        | copy |
        copy := aContact copy.
        (editor contact: aContact) onAnswer: [ :answer |
                answer ifFalse: [
                        "aContact has changed contact regardless of whether
editor answers true or false;
                         copy has the original"
                        MyContact removeContact: aContact.
                        MyContact addContact: copy.
                        "the editor view still has changed value; the view
should be rerendered with original value (the copy)".
                        ]
</code>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Following chapter 12.2 and encountering difficulties with my interpretation of

Intrader Intrader
Found excellent help in the vwnc mailing list. Most helpful folk explaining
many of the intricacies of programming with Smalltalk.
I had an error in my solution. The correct solution is
<code>
editContact: aContact
        | copy |
        copy := aContact copy.
        (editor contact: copy) onAnswer: [ :answer |
        "copy has been updated - keep update if Save"
        answer ifTrue: [MyContact removeContact: aContact; addContact: copy.
                        ]
]
</code>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Following chapter 12.2 and encountering difficulties with my interpretation of

Intrader Intrader
In reply to this post by Intrader Intrader
Looks like removing a contact is incorrect. The problem is that the collection
then finds itself without the contact and the action is repeated. Without
rerendering of the list (containing the anchors), the same contact is used but
it not in the list.
This problem requires a different solution and thinking.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside