Trying to get CTChat to behave like a normal chat app?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Trying to get CTChat to behave like a normal chat app?

John Chludzinski
I'm trying to get CTChat to behave like a normal chat app by getting its #textArea (or my case a #div) to scroll automatically to the bottom when a new message is added.  But because I'm using SUTreeReport which relies on Prototype/Scriptaculous and since JQuery and Prototype/Scriptaculous won't work together, I need need a solution using the older:

   self pusher javascript: [ :script |
      script element
         id: 'messages';
         insertBottom: [ :html | self renderMessage: aBlock class: aString on: html ]].


and well as with the newer (when I'm not using SUTreeReport):

   self pusher javascript: [ :script |
      script << (script jQuery: #messages)
         prepend: [ :html | self renderMessage: aBlock class: aString on: html ]].

I've tried adding PTElement>>scroll to the message cascade for "script element" to no avail.  I've also tried to see if there's something doable using CSS, which does not appear to be the case without some Javascript.

I assume this isn't trivial since it wasn't done originally?

---John

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Trying to get CTChat to behave like a normal chat app?

Lukas Renggli
> I've tried adding PTElement>>scroll to the message cascade for "script
> element" to no avail.  I've also tried to see if there's something doable
> using CSS, which does not appear to be the case without some Javascript.
> I assume this isn't trivial since it wasn't done originally?

The examples that come with the different Seaside libraries are not
ment to be full blown applications. They usually exemplify a certain
very limited set of features. The chat application focuses on Comet,
not on animating DOM elements.

To come back to your question: Scrolling to the bottom of an element
is certainly possible with both libraries, Prototype and JQuery. I
don't know by heart, but Google knows many solutions. Just add you
preferred Javascript framework as an additional tag:

http://www.google.com/search?q=scroll+bottom+element+javascript

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Trying to get CTChat to behave like a normal chat app?

John Chludzinski
In reply to this post by John Chludzinski
Of course this assumes that new messages are added to the bottom - like most chat apps.  ---John

On Mon, Nov 16, 2009 at 5:17 PM, John Chludzinski <[hidden email]> wrote:
I'm trying to get CTChat to behave like a normal chat app by getting its #textArea (or my case a #div) to scroll automatically to the bottom when a new message is added.  But because I'm using SUTreeReport which relies on Prototype/Scriptaculous and since JQuery and Prototype/Scriptaculous won't work together, I need need a solution using the older:

   self pusher javascript: [ :script |
      script element
         id: 'messages';
         insertBottom: [ :html | self renderMessage: aBlock class: aString on: html ]].


and well as with the newer (when I'm not using SUTreeReport):

   self pusher javascript: [ :script |
      script << (script jQuery: #messages)
         prepend: [ :html | self renderMessage: aBlock class: aString on: html ]].

I've tried adding PTElement>>scroll to the message cascade for "script element" to no avail.  I've also tried to see if there's something doable using CSS, which does not appear to be the case without some Javascript.

I assume this isn't trivial since it wasn't done originally?

---John


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Trying to get CTChat to behave like a normal chat app?

John Chludzinski
In reply to this post by John Chludzinski
> To come back to your question: Scrolling to the bottom of an element
> is certainly possible with both libraries, Prototype and JQuery. I
> don't know by heart, but Google knows many solutions. Just add you
> preferred Javascript framework as an additional tag:

> Lukas

Just wanted to make sure I wasn't overlooking something already in Seaside?  ---John

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Trying to get CTChat to behave like a normal chat app?

Lukas Renggli
>> To come back to your question: Scrolling to the bottom of an element
>> is certainly possible with both libraries, Prototype and JQuery. I
>> don't know by heart, but Google knows many solutions. Just add you
>> preferred Javascript framework as an additional tag:
>>
>> http://www.google.com/search?q=scroll+bottom+element+javascript
>>
>> Lukas
> Just wanted to make sure I wasn't overlooking something already in Seaside?

What about something like that?

push: aString with: aBlock
        self pusher javascript: [ :script |
                script element id: 'messages'; insertBottom: [ :html |
                        self renderMessage: aBlock class: aString on: html ].
                script element
                        id: 'messages';
                        access: 'scrollTop';
                        assign: 16777216 ]

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Trying to get CTChat to behave like a normal chat app?

John Chludzinski
In reply to this post by John Chludzinski
> What about something like that?
>
> push: aString with: aBlock
>   self pusher javascript: [ :script |
>       script element id: 'messages'; insertBottom: [ :html |
>       self renderMessage: aBlock class: aString on: html ].
>   script element
>       id: 'messages';
>      access: 'scrollTop';
>      assign: 16777216 ]
>
> Lukas

First, THANKS !  Second, what is the significance of "assign: 16777216" ?

---John

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: Trying to get CTChat to behave like a normal chat app?

Lukas Renggli
> First, THANKS !  Second, what is the significance of "assign: 16777216" ?

Hehe, that's the magic constant that solves all problems ;-)

This is just a random large number to make sure that the scrolls to
the very bottom. Probably you want to remove older items from the top
of the message list anyway to avoid letting it grow infinitely.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Trying to get CTChat to behave like a normal chat app?

John Chludzinski
In reply to this post by John Chludzinski
> This is just a random large number to make sure that the scrolls to
> the very bottom. Probably you want to remove older items from the top
> of the message list anyway to avoid letting it grow infinitely.
>
> Lukas

Genius ! ;-)

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside