Multiline text with smooth vertical scrolling (touch + buttons)

Could you give a clue how to implement visualisation of a long / multiline text which is longer than a single screen?

I can see this in e.g. Garmin Sleep app:

Obviously, on the watch this is scrolling smoothly and all is controlled with touch or Up/Down buttons.

Any hints appreciated!

  • For smooth scrolling maybe something like this?


    There is a onKeyPressed which I believe responds to the user holding down a button. If you were to specify the keys up and down you could make it so while held down it does something like this:

    var UpPress = 0;

    var DownPress = 0;

    onTimerCallback(){
    WatchUi.requestUpdate();

    }

    onKeyRelease(){

    UpPress = 0;

    DownPress = 0;


    timer.stop

    }

    onKeyPressed(){
    if (key == Up){

    UpPress = 1;

    new Timer.Timer(timer,:callback(1000));}

    if (key == down){
    DownPress = 1:

    new Timer.Timer(timer,:callback(1000));

    }

    WatchUi.requestUpdate

    }

    onUpdate(){
    if (DownPress == 1){
    scroll = scroll + 2;

    }

    if (UpPress == 1){
    scroll = scroll - 2;

    }

    //code here to draw text

  • You could do modular arithmetic on the time in seconds.   Work out over how many seconds you want it to scroll.  Use the remainder from time in seconds mod scroll time.  Use it to change the Y position of text.