At the moment I try to use SimpleDataField to return and display a pace value.
class ExactCurrentPace extends Ui.SimpleDataField and method compute(info).
It's possible to return a Integer or Float and simulate the output in the simulator (920xt, square watch).
But it's not possible to return a String-Value (<min>:<sec> e.g. "5:32"). Or the value is returned and
not displayed in the Simulator. To display the Label works fine, but when i return a String the rest of the screen is black.
In the Monkey C documentation i found the following description for SimpleDataField:
"The compute method should return a value to be displayed. Allowed types are Number, Float, Long, Double, and String."
Any ideas?
Coding:
using Toybox.WatchUi as Ui;
using Toybox.Application as App;
using Toybox.System as Sys;
using Toybox.Time as Time;
class ExactCurrentPace extends Ui.SimpleDataField
{
//! Constructor
function initialize()
{
label = "Pace value";
}
//! Handle the update event
function compute(info)
{
return 0.00; // works fine, label and value are displayed in simulator
// return "test" // doesn't work, label is displayed, String not
}
}
//! main is the primary start point for a Monkeybrains application
class SimpleDataField extends App.AppBase
{
function onStart()
{
return false;
}
function getInitialView()
{
return [new ExactCurrentPace()];
}
function onStop()
{
return false;
}
}