Hi,
I am trying to write something on my Datafield so if runners tap on the touchable watch face, the datafield can display a different data. However, I am not able to get the onTap() function to response. Is that the onTap() or onHold() still not supporting datafield?
using Toybox.Application;
class LapEpH4RacerApp extends Application.AppBase {
function initialize() {
AppBase.initialize();
}
//! onStart() is called on application start up
function onStart(state) {
}
//! onStop() is called when your application is exiting
function onStop(state) {
}
//! Return the initial view of your application here
function getInitialView() as Array<Views or InputDelegates>? {
var view = new $.LapEpH4RacerView();
var delegate = new $.SomeOneTouchMe();
return [ view, delegate ] as Array<Views or InputDelegates>;
}
}
import Toybox.WatchUi;
using Toybox.Activity as Act;
using Toybox.Graphics as Gfx;
using Toybox.System as Sys;
using Toybox.FitContributor as Fit;
using Toybox.Timer as Timer;
using Toybox.Application as App;
class SomeOneTouchMe extends WatchUi.BehaviorDelegate {
private var _view as WatchUi.DataField;
public function initialize() {
BehaviorDelegate.initialize();
}
public function onTap() as Boolean {
System.print("Touched!!");
WatchUi.requestUpdate();
return false;
}
// public function onTimerStart() as Boolean {
// _view.onTimerStart();
// return true;
// }
// public function onTimerLap() as Boolean {
// _view.onTimerLap();
// return true;
// }
}
class LapEpH4RacerView extends WatchUi.DataField
{
enum
{
STOPPED,
PAUSED,
RUNNING
}
.
.
.
.
//! constructor
function initialize()
{
DataField.initialize();
var info = Act.getActivityInfo();
.
.
.
.
//! If the activity timer is greater than 0, then we don't know the lap or timer state.
if( (info.timerTime != null) && (info.timerTime > 0) )
{
mLapCertainty = "?";
}
ephToMatch = App.getApp().getProperty("session1");
isInTrainingMode = App.getApp().getProperty("inTraining");
}