Bob Arning | 1 Nov 2010 03:16

Re: Problem with callback blocks sharing context using closure image

Actually, that would not work as written in a closure image. To make it work in closure image, you could write something like:

... aRenderer anchor callback: (makeCallBackWith: index ); ... And then write a method
makeCallBackWith: n ^[self callbackFor: n] In a non-closure image, it would work as written since fixCallbackTemps would have been sent automatically.

Cheers,
Bob

On 10/31/10 9:52 PM, Levente Uzonyi wrote:
On Mon, 1 Nov 2010, Hernán Morales Durand wrote:

Hi all,

I'm experimenting different behavior between Seaside 2.8 and 3.0
regarding parameters passed in callback blocks. Attached there is code
to test in both platforms (just click in any of the first 8 links),
the problem is in the variable index in the #callback: of the
following code

renderBlabla
    | index |
    index := 1.
    8 timesRepeat: [
        aRenderer tableRow: [
            5 timesRepeat: [
                aRenderer tableData: [
                    aRenderer anchor
                        callback: [ self callbackFor: index ];
                        with: 'image link'.
                    index := index + 1.
                ]  ] ] ].

In Seaside 2.8 after clicking the link 3 for example, the
#callbackFor: method received 3 as parameter.
In Seaside 3.0 #callbackFor: receive 41.

I would like to preserve the parameter value configured in the
rendering phase, any suggestion how to do that in Seaside 3? (Using
PharoVM 4.0.2 12/4/2010 and Pharo1.1rc2 #11400)

Use an image with support for closures. Or if that's not possible, then send #fixTemps to the callback block.


Levente

Cheers,

-- 
Hernán Morales
Information Technology Manager,
Institute of Veterinary Genetics.
National Scientific and Technical Research Council (CONICET).
La Plata (1900), Buenos Aires, Argentina.
Telephone: +54 (0221) 421-1799.
Internal: 422
Fax: 425-7980 or 421-1799.

_______________________________________________ seaside mailing list seaside <at> lists.squeakfoundation.org http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
_______________________________________________
seaside mailing list
seaside <at> lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Gmane