You are reading a single comment by @Sir_Indy and its replies. Click here to read the full conversation.
  • You're correct that layout.update takes a long time, because it's recalculating the sizes of every element. But there are other ways to update only certain elements of the layout, see the docs here: https://www.espruino.com/Bangle.js+Layout#updating-the-screen.
    The first is 'lazy' - it will only update the items that have changed when you call layout.render (not .update, you shouldn't need to call that manually).

    The second is, if you give the items you want to change in your layout an id, you can clear it, update it, then render just that item:

    my_layout.clear(my_layout[id_name]);
    my_layout[id_name].label = new_value;
    my_layout.render(my_layout[id_name]);
    

    This doesn't change the size, or change any other items, so it's much faster.
    I made this into a function in one of my apps to repeatedly change text values: https://github.com/sir-indy/BangleApps/blob/2508fd38abf4c1f701967824395a311c6c34b114/apps/smpltmr/app.js#L167-L171

    Hope that helps!

About

Avatar for Sir_Indy @Sir_Indy started