I am very new to this. So far I have
using Toybox.WatchUi;
using Toybox.Graphics as Gfx;
using Toybox.Communications;
class MyBehaviorDelegate extends WatchUi.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
function onMenu() {
var menu = new WatchUi.Menu();
var delegate;
menu.setTitle("My Menu");
menu.addItem("Item One", :one);
menu.addItem("Item Two", :two);
delegate = new WatchUi.MenuInputDelegate(); // a WatchUi.MenuInputDelegate
WatchUi.pushView(menu, delegate, WatchUi.SLIDE_IMMEDIATE);
return true;
}
}
class SpeedView extends WatchUi.View {
hidden var _textArea;
hidden var _textAreaTwo;
function initialize() {
View.initialize();
initialize(settings as { :behavior as Lang.Symbol, :background as Graphics.ColorType or WatchUi.Drawable });
}
function onLayout(dc) {
var info = ActivityMonitor.getInfo();
var steps = info.steps;
var calories = info.calories;
var place = "2nd";
_textArea = new WatchUi.TextArea({
:text=>"you are in " + place + " worldwide.",
:color=>Graphics.COLOR_WHITE,
:font=>[Graphics.FONT_SYSTEM_MEDIUM],
:locX =>WatchUi.LAYOUT_HALIGN_CENTER,
:locY=>WatchUi.LAYOUT_VALIGN_CENTER,
:width=>dc.getWidth()* 2/3,
:height=>dc.getHeight() * 2/3
});
}
function onUpdate(dc) {
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK);
dc.clear();
_textArea.draw(dc);
}
}
for example, how can use the main watch button to do the onMenu function?