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: [hidden email] > To: [hidden email] > > > 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 > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside Hotmail: Powerful Free email with security by Microsoft. Get it now. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> 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? Unless you use AJAX, all the code execution happens in Javascript in the web browser: (html jQuery: #foo) text: (html jQuery: #bar) offsetLeft In this case the expression is transformed to Javascript something along the following lines: $("#foo").text($("#bar").offset.left) Have a look at the generated code in FireBug. > How can I get the offset value and store it in an instance variable then? Attach this script to the #onStop: handler of the draggable: html ajax callback: [ :value | left := value ] value: (html jQuery: #bar) offsetLeft; callback: [ :value | top := value ] value: (html jQuery: #bar) offsetTop Again check out the generated code in FireBug and inspect the request it triggers off. Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
>>>>> "Lukas" == Lukas Renggli <[hidden email]> writes:
Lukas> Have a look at the generated code in FireBug. I know FireBug set a pretty high standard, but if you haven't played with the new Safari debugger, you might be missing out. I've switched over to it entirely, and FireBug now feels a bit clunky. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[hidden email]> <URL:http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Lukas Renggli
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:
html div id: 'areaView'; script: ((html jQuery new draggable) grid: #(150 150); onDrag: ( html jQuery ajax callback: [:value | self top: value] value: (html jQuery this offset access: 'top'); callback: [:value | self left: value] value: (html jQuery this offset access: 'left') ) ); with: ["..."]. 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. Anyway, I had a question about the primary/secondary callbacks again: Lukas: " You can only register one primary callback for an ajax object, e.g.
> Date: Wed, 23 Sep 2009 08:28:17 +0200 > Subject: Re: [Seaside] Detect the position of a page div > From: [hidden email] > To: [hidden email] > > > 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? > > Unless you use AJAX, all the code execution happens in Javascript in > the web browser: > > (html jQuery: #foo) text: (html jQuery: #bar) offsetLeft > > In this case the expression is transformed to Javascript something > along the following lines: > > $("#foo").text($("#bar").offset.left) > > Have a look at the generated code in FireBug. > > > How can I get the offset value and store it in an instance variable then? > > Attach this script to the #onStop: handler of the draggable: > > html ajax > callback: [ :value | left := value ] value: (html jQuery: #bar) offsetLeft; > callback: [ :value | top := value ] value: (html jQuery: #bar) offsetTop > > Again check out the generated code in FireBug and inspect the request > it triggers off. > > Cheers, > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside Bing™ brings you maps, menus, and reviews organized in one place. Try it now. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> So if I am passing a value to the callback it is considered a secondary
> callback because it doesn't have to > go and find values or something? Sorry, would you mind explaining it again? The primary callbacks generates the response. An AJAX request cannot generate two responses, that's why you can define at most one primary callback. Secondary callbacks are used to move values from the client to the server. You can transform multiple values with one request at once. That's why one is encouraged to define multiple secondary callbacks at once. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I understand that when a page finishes loading an element, its "load" event will be triggered (assuming it is defined). I have a "#renderContentOn:" method with a table followed by a jQuery dialog (the dialog contains the "#onLoad:" event). Am I correct in the assumption that evaluating a function that selects the table (which should be rendered already?) will work?
If I change the event to "#onClick:" it works just fine, but not with "#onLoad:". I can provide some code if necessary, but I imagine I'm not taking into account something more fundamental. Thanks! RS Hotmail: Trusted email with powerful SPAM protection. Sign up now. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> I understand that when a page finishes loading an element, its "load" event will be triggered (assuming it is defined). I have a "#renderContentOn:" method with a table followed by a jQuery dialog (the dialog contains the "#onLoad:" event). Am I correct in the assumption that evaluating a function that selects the table (which should be rendered already?) will work?
No, the onLoad event only works (in a cross browser fashion) only on the root element of the DOM tree, i.e. the body. You could use the onOpen event on the jQuery dialog object. Lukas > > If I change the event to "#onClick:" it works just fine, but not with "#onLoad:". I can provide some code if necessary, but I imagine I'm not taking into account something more fundamental. > > Thanks! > RS > > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I only did a little research on the subject, and am mostly looking for a little direction regarding the following topics.
What I would like to do is set up a recurring event on the server (say, every minute), and announce it as these intervals elapse. There's some style of HTTP request called comet, I think, and it lets the server send information to the clients without their asking for it. I guess another way to do it is by sending a request to the server just to see if an event has occurred (long polling). Maybe I'm heading down the road, but I haven't any idea how to implement any of this regardless. Thanks! RS Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign up now. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> What I would like to do is set up a recurring event on the server (say,
> every minute), and announce it as these intervals elapse. There's some style > of HTTP request called comet, I think, and it lets the server send > information to the clients without their asking for it. There is a package called 'Comet' for Seaside 2.8 and 3.0 that does what the package name says. > I guess another way > to do it is by sending a request to the server just to see if an event has > occurred (long polling). That can be done too. See the the periodic updater in the Scriptaculous package (Seaside 2.8) and in the Prototype package (Seaside 3.0). Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I downloaded Seaside 3 into the latest Pharo image (via ScriptLoader) and fired up some of the Comet tests and ended up with some WAError - Streaming something or another required. I was running a Comanche server... is that the correct way to do it?
RS Hotmail: Trusted email with Microsoft’s powerful SPAM protection. Sign up now. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> I downloaded Seaside 3 into the latest Pharo image (via ScriptLoader) and
> fired up some of the Comet tests and ended up with some WAError - Streaming > something or another required. I was running a Comanche server... is that > the correct way to do it? No, you need to use WAListener. Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I'm attempting to create a simple little comet app that gives you the current date and time. I looked over the tests a bit and decided to emulate the CTCounter example.
How does the pusher actually work? Does it send data to the client only when something is updated serverside? And how does it know which pieces of the page to update? The ones calling methods on the class? RS > Date: Sun, 4 Oct 2009 22:37:54 -0600 > Subject: Re: [Seaside] Comet > From: [hidden email] > To: [hidden email] > > > I downloaded Seaside 3 into the latest Pharo image (via ScriptLoader) and > > fired up some of the Comet tests and ended up with some WAError - Streaming > > something or another required. I was running a Comanche server... is that > > the correct way to do it? > > No, you need to use WAListener. > > Lukas > > -- > Lukas Renggli > http://www.lukas-renggli.ch > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside Hotmail: Trusted email with powerful SPAM protection. Sign up now. _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
El lun, 05-10-2009 a las 12:25 -0600, Robert Sirois escribió:
> I'm attempting to create a simple little comet app that gives you the > current date and time. I looked over the tests a bit and decided to > emulate the CTCounter example. > The book has a section about Comet that has this very example. > How does the pusher actually work? Does it send data to the client > only when something is updated serverside? And how does it know which > pieces of the page to update? The ones calling methods on the class? > You must trigger the update in the server. This will be pushed to all the clients registered. Also, you'll get a brush to update the html as you wish. > RS > > > Date: Sun, 4 Oct 2009 22:37:54 -0600 > > Subject: Re: [Seaside] Comet > > From: [hidden email] > > To: [hidden email] > > > > > I downloaded Seaside 3 into the latest Pharo image (via > ScriptLoader) and > > > fired up some of the Comet tests and ended up with some WAError - > Streaming > > > something or another required. I was running a Comanche server... > is that > > > the correct way to do it? > > > > No, you need to use WAListener. > > > > Lukas > > > > -- > > Lukas Renggli > > http://www.lukas-renggli.ch > > _______________________________________________ > > seaside mailing list > > [hidden email] > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > ______________________________________________________________________ > Hotmail: Trusted email with powerful SPAM protection. Sign up now. > _______________________________________________ > seaside mailing list > [hidden email] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside Miguel Cobá http://miguel.leugim.com.mx _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |