[Seaside] Re: WAImageMapTag problem with Scriptaculous?
Julian Fitzell
jfitzell at gmail.com
Tue Nov 10 23:52:53 UTC 2009
Right, the "return: false" prevents the normal callback from
executing. "return: true" (the default) will allow the callback to
execute, but (a) not until after the javascript one and (b) of course
it loads a new page because you have clicked on a new link. This is
all just the way HTML works.
I think you need to use #callback:value:. Something like:
html map
onClick: (html scriptaculous evaluator
callback: [:x | x < 200 ifTrue: [self previousPage] ifFalse:
[self nextPage]]
value: (JSStream on: 'arguments[0].x');
callback: [ :script | "use :script to update the DOM element
with the current image" ];
return: false);
Except that isn't quite right because "arguments[0].x" returns the x
position on the screen. I don't know how you get the position within
the map. (also JSStream is SUStream in Seaside 2.8).
Julian
On Tue, Nov 10, 2009 at 3:02 PM, John Chludzinski
<john.chludzinski at gmail.com> wrote:
> If I use:
>
> html map
> callback: [ :point | point x > 200 ifTrue: [ self nextPage ] ifFalse:
> [ self previousPage ]];
> with: [ html image id: #WWW; url: MMAFileLibrary / self
> getCurrentPageFile ]].
> This works BUT the entire page in re-rendered. Not what I want.
> If I use:
> html map
> onClick: (html scriptaculous evaluator
> callback: [ :script | self nextPage ];
> return: false);
> This updates the instance of WAImageMapTag with the next slide (without
> re-rendering the entire page) BUT I don't have access to 'point' to
> determine whether to invoke either #nextPage or #previousPage.
> ---John
> On Tue, Nov 10, 2009 at 5:10 PM, John Chludzinski
> <john.chludzinski at gmail.com> wrote:
>>
>> I trying to use an instance of WAImageMapTag to hold a slide (in a
>> presentation). Instead of using buttons (on an iPod), I'm trying to advance
>> to the next slide by clicking on the right half of the slide or going back
>> to the previous slide by clicking on the left half. This requires I have
>> access to 'point' in 'callback: [ :point | ... ]' associated with the
>> instance of WAImageMapTag. But when using Scriptaculous, I'd like to have
>> something like this:
>>
>> html map
>> onClick: (html scriptaculous evaluator
>> callback: [ :script | self x > 200 ifTrue: [ self nextPage ]
>> ifFalse: [ self previousPage ]];
>> return: false);
>> callback: [ :point | self x: point x ];
>> with: [ html image id: #WWW; url: MMAFileLibrary / self
>> getCurrentPageFile ]].
>>
>> This doesn't work (my conclusion?) because the #callback: in the
>> Scriptaculous evaluator: "Registers aBlock as a primary callback of the
>> receiver." and the other callback ([ :point | self x: point x ]) is never
>> invoked? Is there a solution to this Catch-22?
>> ---John
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
More information about the seaside
mailing list