[Seaside] Image Zoomer: How to capture mouseOver X & Y

Lukas Renggli renggli at gmail.com
Sat Apr 3 07:44:14 UTC 2010


> What I'd like to do is get the position of the mouse
> (http://docs.jquery.com/Types/Event#event.pageX.2FY) and send the value to
> an ajax callback like below:
>
> ...
>         onClick: (html jQuery ajax
>             callback: [:v | self session mousePosTop: v ] value: 'y val';
>             callback: [:v | self session mousePosLeft: v ] value: 'x val'
>         );
> ...

That would be:

      callback: [:v | self session mousePosTop: v ] value: 'argument[0].pageX';
      callback: [:v | self session mousePosLeft: v ] value: 'argument[0].pageY'

'argument[0]' is the event object passed into the event handler.
'pageX' is the attribute as given in the JQuery documentation.

Currently the JQuery event object is not reified in Smalltalk, that's
why you need to use these Javascript strings. I guess that should (and
could easily) be changed. Can you create an issue in the bug-tracker?

Alternatively you can serialize the complete event object, this
requires that you add the JSJsonDevelopmentLibrary though:

      callback: [ :v | v inspect ] json: 'argument[0]'

Lukas

-- 
Lukas Renggli
www.lukas-renggli.ch


More information about the seaside mailing list