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 [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
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 <[hidden email]> wrote:
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
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 <[hidden email]> 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 > <[hidden email]> 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 > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by John Chludzinski
This works: html map onClick: (html scriptaculous evaluator callback: [ :x | x asInteger < 200 ifTrue: [ self previousPage ] ifFalse: [ self nextPage ]] value: (JSStream on: 'arguments[0].x'); callback: [ :script | true ]; return: false); with: [ html image id: #WWW; url: MMAFileLibrary / self getCurrentPageFile ]. The calls to #previousPage and #nextPage have the script to update the DOM element with the previous or next slide. Tried before to use #callback:value: (as a "secondary callback") but didn't add the additional #callback: (as a "primary callback"). That doesn't work! Thanks Julian! ---John _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
2009/11/11 John Chludzinski <[hidden email]>:
> This works: > > html map > onClick: (html scriptaculous evaluator > callback: [ :x | x asInteger < 200 ifTrue: [ self previousPage ] > ifFalse: [ self nextPage ]] > value: (JSStream on: 'arguments[0].x'); > > callback: [ :script | true ]; > return: false); > > with: [ html image id: #WWW; url: MMAFileLibrary / self > getCurrentPageFile ]. > > The calls to #previousPage and #nextPage have the script to update the DOM > element with the previous or next slide. > Tried before to use #callback:value: (as a "secondary callback") but didn't > add the additional #callback: (as a "primary callback"). That doesn't work! > what about using <form action="javascript:foo()"> <input type="image" ...> </form> ? Then you could simply check what side of image get clicked in your javascript function. > Thanks Julian! > ---John > > > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > -- Best regards, Igor Stasenko AKA sig. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |