onPartialUpdate() event.

Former Member
Former Member

Hello guys so I start to create my watch face and I want to add the onPartialUpdate () event to my code so I can use it for seconds and heart rate every second this is my code: 

import Toybox.Graphics;
import Toybox.Lang;
import Toybox.System;
import Toybox.WatchUi;

class WatchFaceView extends WatchUi.WatchFace {

function initialize() {
WatchFace.initialize();
}

// Load your resources here
function onLayout(dc as Dc) as Void {
setLayout(Rez.Layouts.WatchFace(dc));
}

// Called when this View is brought to the foreground. Restore
// the state of this View and prepare it to be shown. This includes
// loading resources into memory.
function onShow() as Void {
}

// Update the view
function onUpdate(dc as Dc) as Void {
System.println(dc.getWidth);
// Get and show the current time
var clockTime = System.getClockTime();
var timeString = Lang.format("$1$:$2$", [clockTime.hour, clockTime.min.format("%02d")]);
var view = View.findDrawableById("TimeLabel") as Text;
view.setText(timeString);

// Call the parent onUpdate function to redraw the layout
View.onUpdate(dc);
}

// Called when this View is removed from the screen. Save the
// state of this View here. This includes freeing resources from
// memory.
function onHide() as Void {
}

// The user has just looked at their watch. Timers and animations may be started here.
function onExitSleep() as Void {
}

// Terminate any active timers and prepare for slow updates.
function onEnterSleep() as Void {
}

}