using Toybox.WatchUi as Ui;
using Toybox.Application as App;
using Toybox.System as Sys;
using Toybox.Time as Time;
using Toybox.Activity as Act;
using Toybox.Graphics as Gfx;
class DataField extends Ui.DataField
{
var called_onLayout;
var called_onShow;
function initialize() {
called_onShow = false;
called_onLayout = false;
}
function onLayout(dc) {
called_onLayout = true;
}
function onShow() {
called_onShow = true;
}
function onUpdate(dc) {
if (!called_onShow) {
Sys.error("Ui.DataField.onShow() was not called before onUpdate().");
}
if (!called_onLayout) {
Sys.error("Ui.DataField.onLayout() was not called before onUpdate().");
}
}
}
//! main is the primary start point for a Monkeybrains application
class ComplexDataField extends App.AppBase
{
function onStart() {
return false;
}
function getInitialView() {
return [new DataField()];
}
function onStop() {
return false;
}
}
The output of the above program is as follows...
C:\Garmin\connectiq\connectiq-win-0.1.1\samples\ComplexDataField>nmake /nologo all start run
monkeyc -o bin\ComplexDataField.prg -m .\manifest.xml -z resources\resources.xml source\ComplexDataField.mc source\Graph.mc
connectiq
timeout /nobreak /t 2
Waiting for 0 seconds, press CTRL+C to quit ...
monkeydo bin\ComplexDataField.prg
Found Transport: tcp
Connecting...
Connecting to device...
Device Version 0.1.0
Device id 1 name "A garmin device"
Shell Version 0.1.0
Copying file.... 9% complete
Copying file.... 18% complete
Copying file.... 28% complete
Copying file.... 37% complete
Copying file.... 46% complete
Copying file.... 56% complete
Copying file.... 65% complete
Copying file.... 75% complete
Copying file.... 84% complete
Copying file.... 93% complete
Copying file.... 100% complete
File pushed successfully
Connection Finished
Closing shell and port
Found Transport: tcp
Connecting...
Connecting to device...
Device Version 0.1.0
Device id 1 name "A garmin device"
Shell Version 0.1.0
Ui.DataField.onShow() was not called before onUpdate().
Success
in onUpdate (source\ComplexDataField.mc:29)
in onUpdate (source\ComplexDataField.mc:29)
System Error
System Error