[SailfishDevel] Read-only TextArea: Always keep the lines added last visible

Андрей Кожевников coderusinbox at gmail.com
Fri Jan 2 08:21:48 UTC 2015


1. Why TextArea? Why not ListView + ListModel.
2. TextArea have own scroller, you dont need Flickable. Just try to use
cursorPosition property or avoid using TextArea.
02.01.2015 9:59 пользователь "Dirk Zimmermann" <me+sailfishos at dirkz.com>
написал:

> Hi all,
>
> I was trying to use a TextArea as a UI-visible debug log, so I can see
> connection error details while I'm out using my app. The basic principle
> is that the python code (pyotherside) will make a server request and
> send detailed answers to the text area, which displays them. Everything
> works find, except the text area doesn't auto scroll to the end when
> there is more content than fits on the page. autoScrollenabled seems to
> mean something entirely different, selectionStart start seems to be
> read-only. I have put up an example that demonstrates, at the end of the
> mail.
>
> Does anyone know of the magic incantations needed to make sure the
> latest lines are always visible?
>
> import QtQuick 2.0
> import Sailfish.Silica 1.0
>
> Page {
>     id: textAreaLogExample
>
>     SilicaFlickable {
>         TextArea {
>             id: textAreaLog
>             readOnly: true
>             text: "Test"
>             autoScrollEnabled: true
>         }
>     }
>
>     Timer {
>         interval: 500; running: true; repeat: true
>         onTriggered: {
>             textAreaLog.text += "\n" + new Date().getUTCSeconds() + " Log"
>         }
>     }
> }
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to
> devel-unsubscribe at lists.sailfishos.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20150102/c457fa59/attachment.html>


More information about the Devel mailing list