[Seaside] Detect the position of a page div

Robert Sirois watchlala at hotmail.com
Wed Sep 23 03:48:03 UTC 2009


Alright, I think I'm starting to understand the process of events here. What I'm still confused about, however, is exactly what "#text:" does. How is it able to render the value of "((html jQuery: #whatever) offset access: 'top')" when I can't assign that value to a component variable, render it with "#html:", or even show it with Transcript? Is that because the function has to be rendered (for JavaScript to deal with) first?

How can I get the offset value and store it in an instance variable then?

The following is an example of something I tried that didn't return anything :/

    html div
        id: 'areaView';
        onLoad: (html jQuery ajax script: [:s | s add: (self top: (s jQuery this offset access: 'top'))]);
        onLoad: (html jQuery ajax script: [:s | s add: (self left: (s jQuery this offset access: 'left'))]);
        script: (html jQuery new draggable);
        with: [...].

Thanks!
RS

> Date: Tue, 22 Sep 2009 21:56:31 +0200
> Subject: Re: [Seaside] Detect the position of a page div
> From: renggli at gmail.com
> To: seaside at lists.squeakfoundation.org
> 
> > So "#text:" doesn't expect the same thing as "#html:" then?
> 
> Nop, but you are right. Maybe that's not quite right what Seaside does here?
> 
> > Oh, also. I recall a comment somewhere that you can only register one
> > callback on a class? Does that only apply to seaside components?
> 
> No, this has nothing to do with components.
> 
> You can only register one primary callback for an ajax object, e.g.
> 
>   html jQuery ajax callback: [ ... ]; callback: [ ... ]  " <-- wrong "
> 
> does not make sense, because Seaside returns a response after
> processing the primary callback. However you can register as many
> secondary callbacks as you want, e.g. to serialize values to the
> server:
> 
>   html jQuery ajax " <-- correct "
>      callback: [ :v1 | "this is a secondary callback" ] value: ....;
>      callback: [ :v2 | "this is a secondary callback" ] value: ....;
>      html: [ :h | "this is a primary callback that generates html,
> internally it calls #callback:" ];
>      ...
> 
> Note that the primary callback is always evaluated last, whereas the
> secondary callback are evaluated before in order they were defined.
> 
> Hope this helps?
> 
> Lukas
> 
> 
> -- 
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20090922/a8489d91/attachment.htm


More information about the seaside mailing list