<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
I see how it works now. The js functions are captured in the callbacks, and the callbacks are triggered when an event takes place (in this case #onDrag:). Here is my updated code:<br><br> html div<br> id: 'areaView';<br> script: ((html jQuery new draggable) grid: #(150 150); onDrag: (<br> <br> html jQuery ajax<br> callback: [:value | self top: value] value: (html jQuery this offset access: 'top');<br> callback: [:value | self left: value] value: (html jQuery this offset access: 'left')<br> <br> )<br> );<br> with: ["..."].<br><br>One thing I just realized is that #onDrag: is trigged as long as the dealy bob (html element) is bein dragged, but not at a regular consistency. Even with the grid function, it still can't keep up with what I'm doin on the page. I havn't tried it yet, but I was thinking maybe I could use scrollspeed or something to fix this little problem... or maybe it doesn't matter. I suppose it's updating the offset correctly, so if it skips a few movements, the smoothness of what I'm doing with this data will just be a little... well, less smooth.<br><br>Anyway, I had a question about the primary/secondary callbacks again: <br><br>Lukas:<br>"<br>You can only register one primary callback for an ajax object, e.g.<br><pre> <br> html jQuery ajax callback: [ ... ]; callback: [ ... ] " <-- wrong "<br> <br>does not make sense, because Seaside returns a response after<br>processing the primary callback. However you can register as many<br>secondary callbacks as you want, e.g. to serialize values to the<br>server:<br> <br> html jQuery ajax " <-- correct "<br> callback: [ :v1 | "this is a secondary callback" ] value: ....;<br> callback: [ :v2 | "this is a secondary callback" ] value: ....;<br> html: [ :h | "this is a primary callback that generates html,<br>internally it calls #callback:" ];<br> ...<br> <br>Note that the primary callback is always evaluated last, whereas the<br>secondary callback are evaluated before in order they were defined.<br>"<br><br>So if I am passing a value to the callback it is considered a secondary callback because it doesn't have to<br>go and find values or something? Sorry, would you mind explaining it again?<br><br>Thanks!<br>RS<br></pre><br><br>> Date: Wed, 23 Sep 2009 08:28:17 +0200<br>> Subject: Re: [Seaside] Detect the position of a page div<br>> From: renggli@gmail.com<br>> To: seaside@lists.squeakfoundation.org<br>> <br>> > Alright, I think I'm starting to understand the process of events here. What<br>> > I'm still confused about, however, is exactly what "#text:" does. How is it<br>> > able to render the value of "((html jQuery: #whatever) offset access:<br>> > 'top')" when I can't assign that value to a component variable, render it<br>> > with "#html:", or even show it with Transcript? Is that because the function<br>> > has to be rendered (for JavaScript to deal with) first?<br>> <br>> Unless you use AJAX, all the code execution happens in Javascript in<br>> the web browser:<br>> <br>> (html jQuery: #foo) text: (html jQuery: #bar) offsetLeft<br>> <br>> In this case the expression is transformed to Javascript something<br>> along the following lines:<br>> <br>> $("#foo").text($("#bar").offset.left)<br>> <br>> Have a look at the generated code in FireBug.<br>> <br>> > How can I get the offset value and store it in an instance variable then?<br>> <br>> Attach this script to the #onStop: handler of the draggable:<br>> <br>> html ajax<br>> callback: [ :value | left := value ] value: (html jQuery: #bar) offsetLeft;<br>> callback: [ :value | top := value ] value: (html jQuery: #bar) offsetTop<br>> <br>> Again check out the generated code in FireBug and inspect the request<br>> it triggers off.<br>> <br>> Cheers,<br>> Lukas<br>> <br>> -- <br>> Lukas Renggli<br>> http://www.lukas-renggli.ch<br>> _______________________________________________<br>> seaside mailing list<br>> seaside@lists.squeakfoundation.org<br>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside<br>                                            <br /><hr />Bing™ brings you maps, menus, and reviews organized in one place. <a href='http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TEXT_MLOGEN_Core_tagline_local_1x1' target='_new'>Try it now.</a></body>
</html>