-
• #2
You typically only call Bangle.drawWidgets() once at the end of the code to force each widget to redraw itself. The call to render will happen inside your draw() function. Thereafter each widgets decides when it will redraw itself.
var clockLayout = new Layout( { // etc. }); function draw() { // etc clockLayout.clear(); clockLayout.render(); } g.clear(); // can put draw(); here Bangle.setUI("clock"); // Show launcher when middle button pressed Bangle.loadWidgets(); Bangle.drawWidgets(); draw();
-
• #3
If you call
Bangle.loadWidgets();
beforelayout = new Layout({...})
, the layout library knows to reserve space for widgets. -
• #4
great, this works in a new project. I tried to integrate it into an existing clock, which didn't went as well, but I will just rewrite it from scratch now. Thanks for the help.
Hello there.
I started working on a clock with the layout library, to ideally be able to use the clock on both Bangles. Now I wonder how the expected way is to deal with widgets. If I call drawWidgets() after the layout.render(), it works perfectly, but if I call render() after, it overrides the widgets. How is the expected way to deal with this? I searched a bit around in the tutorials and library docs but wasn't able to find it.