Build-in apps style scrollbar - how to implement them.

I was wondering how to implement build-in app like scroll bar for app that allows switching active views.

I saw there is a way to switch views wit slide up/down animation but how overlay that with scroll bar?

I went through samples and API doc but could not find anything like this.

1727.VID_20200127_002120.m4v

  • Hi,

    There is no such scrollbar object for layouts.

    You will need to draw directly on the canvas using the DC in the onUpdate() function.

    function onUpdate(dc) {
    
        // Do anything to your layout
        // ...
    
        View.onUpdate(dc);
    
        // Draw on the canvas
        var penWidth = 12;
        var x = dc.getWidth()/2;
        var y = dc.getHeight()/2;
        var radius = (x < y) ? (x - (penWidth/2)) : (y - (penWidth/2));
        var start = 180;
        var end = 90;
        
        dc.setPenWidth(penWidth);
        dc.setColor(Graphics.COLOR_LT_GRAY, Graphics.COLOR_WHITE);
        
        dc.drawArc(x, y, radius, Graphics.ARC_CLOCKWISE, start , end);
    }

    Do this for each view, playing with start and end variables, and use a different color for the current view.