RichTextArea: Scrolling to Bottom

Hi:

I am using a RichTextArea for displaying incoming messages in an webapp.

I wonder if it is possible to scroll to the last line of messages/text in a RichTextArea after messages/text are being added programmatically to it, so that the last line of the message/text added in always visible??

Pls advise. Thank you.

Unfortunately there is no out of the box solution for this. After fiddling around with it a bit I came up with the following that worked for me :

  1. Extend the RichTextArea components client side
  2. Change the lines in the
    public void updateFromUIDL(final UIDL uidl, ApplicationConnection client)
    method that read
        if (uidl.hasVariable("text")) {
            currentValue = uidl.getStringVariable("text");
            if (rta.isAttached()) {
                rta.setHTML(currentValue);
            } else {
                html.setHTML(currentValue);
            }
        }

to read if (uidl.hasVariable("text")) { currentValue = uidl.getStringVariable("text"); if (rta.isAttached()) { rta.setHTML(currentValue); IFrameElement iframe = IFrameElement.as(rta.getElement()); Document document = iframe.getContentDocument(); document.setScrollTop(document.getScrollHeight()); } else { html.setHTML(currentValue); } } instead.

Thank you very much for the suggestion.

Will try it out after vacation, and let you know.