I changed to SDK 7.2.0 and "migrated" all my Edge Datafields to 7.2.0.
It was necessary to change all xxApp.mc files.
I use in all my datafields the (nearly) same code for inputDelegate Click Event.
It works in nearly all datafield without problems - only one Datafield throws an Error:
App.mc
import Toybox.Application;
import Toybox.Lang;
import Toybox.WatchUi;
(:background)
class EdgeAllinOne58App extends Application.AppBase {
var view = null;
function initialize() {
AppBase.initialize();
}
// onStart() is called on application start up
function onStart(state as Dictionary?) as Void {
}
// onStop() is called when your application is exiting
function onStop(state as Dictionary?) as Void {
}
/* up to SDK 2.6.4
//! Return the initial view of your application here
function getInitialView() as Array<Views or InputDelegates>? {
view = new EdgeAllinOne58View();
Background.registerForTemporalEvent(new Time.Duration(5 * 60));
return [ view, new InputDelegate(view) ] as Array<Views or InputDelegates>;
}
*/
// from SDK 7
//! Return the initial view of your application here
function getInitialView() as [Views] or [Views, InputDelegates] {
view = new EdgeAllinOne58View();
Background.registerForTemporalEvent(new Time.Duration(5 * 60));
return [ view, new InputDelegate(view) ];
}
function onBackgroundData(data) {
System.println( "data=" + data );
if ( view != null ) {
view.tempEdge = data;
}
}
function getServiceDelegate(){
return [new SensDFServiceDelegate()];
}
}
function getApp() as EdgeAllinOne58App {
return Application.getApp() as EdgeAllinOne58App;
}
The error is thrown in the View.mc on the line (line 13 in below code):
//-------------------------------------------------------------------
class InputDelegate extends WatchUi.BehaviorDelegate {
// für tap Event
var view;
var tX;
var tY;
function initialize(v) {
BehaviorDelegate.initialize();
view = v;
}
function onTap(clickEvent) {
var tapCoordinates = clickEvent.getCoordinates();
tX = tapCoordinates[0];
tY = tapCoordinates[1];
if ( view.deviceInUse != 7 ) {
if ( tX > 130 and tY < 100 ) { // tap auf Varia Batterie
if ( view.showVariaBat == true ) {
view.showVariaBat = false;
} else {
view.showVariaBat = true;
}
//System.println("TAP!");
return true;
}
} else {
return false;
}
}
}