<layout id="MainLayout">
<label x="center" y="5" text="@Strings.prompt" color="Gfx.COLOR_WHITE" justification="Gfx.TEXT_JUSTIFY_CENTER" />
<bitmap id="id_monkey" x="center" y="30" filename="../drawables/monkey.png" />
<button x="center" y="center" width="150" height="40" background="Gfx.COLOR_BLACK" behavior="myButton">
<state id="stateDefault" color="Gfx.COLOR_GREEN" />
<state id="stateHighlighted" color="Gfx.COLOR_RED" />
<state id="stateSelected" color="Gfx.COLOR_BLUE" />
<state id="stateDisabled" color="Gfx.COLOR_PURPLE" />
</button>
</layout>
In the delegate.mc file, I add the the following function in
function myButton() {
System.println("Hello");
}
so it now looks like this
using Toybox.WatchUi as Ui;
class Delegate extends Ui.BehaviorDelegate {
function initialize() {
BehaviorDelegate.initialize();
}
function onMenu() {
Ui.pushView(new Rez.Menus.MainMenu(), new MenuDelegate(), Ui.SLIDE_UP);
return true;
}
function myButton() {
System.println("Hello");
}
}
mainly so I could include the "behavior" attribute and point it to a function. It's an optional attribute according to the docs, but it makes no difference if I include it or not.
When run in the simulator, it does as expected and produces a button that can be clicked, changes color when clicked, and with the delegate, displays the Hello message in the console.
When this app is placed onto an actual FR630, it dies on startup and never gets to display anything.
I have been trying to figure this our for hours and getting nowhere.
Can anyone se anything I may have done thats preventing this from working ?