Buttons on Forerunner 235

Hi there,

I have an widget that has a menu in it that opens when a user presses the menu button on a watch with a menu button to the Menu/Up button on non-touch watches. A user says that they have a Forerunner 235 but they say that they cannot get into the menu. I am pretty sure that it works on the Fenix3. The way that I have implemented the menu entry is with the following code:


function onMenu()
{

mainmenu = new Rez.Menus.MainMenu();
//mainmenu.setTitle("Main");
//Ui.pushView( new CGMMenu(), new CGMMenuDelegate(), Ui.SLIDE_IMMEDIATE );
Ui.pushView( mainmenu, new CGMMenuDelegate(), Ui.SLIDE_IMMEDIATE );
//return true;
sys.println ("Menu pressed");
return true;
}

function onKeyReleased(releaseevt)
{
// For watches with buttons you need to launch the menu from a key press or release, not onMenu.
var keyid = releaseevt.getKey();
sys.println (keyid.toString());
if (keyid.toLong() == 13 || keyid.toLong() == 18) {
// key 13 is menu in fenix3
Ui.pushView( new Rez.Menus.MainMenu(), new CGMMenuDelegate(), Ui.SLIDE_IMMEDIATE );
}
//return true;
sys.println ("key pressed");
return true;
}


class CGMMenuDelegate extends Ui.MenuInputDelegate {
//********************************************************************************************
// This is the main menu in the app.
//
//********************************************************************************************

function onMenuItem(item) {
sys.println ("CGMMenuDelegate entered");
if (item == :item_1) {
// Need to adjust this so that the settings menu does different things

activemenu = new Rez.Menus.SettingsMenu();
activemenu.setTitle("Settings");

Ui.pushView(activemenu, new SettingsMenuDelegate(), Ui.SLIDE_UP);


} else if (item == :item_2) {
// Do something else here in the Graphs menu
Ui.switchToView(new CGMGraphView(), new BackOutDelegate(), Ui.SLIDE_UP);
//cgmChartmodel.onGraph();
sys.println(" entering graph screen");
return globalText;
}
}
}




According to the simulator and the devices.xml file the up button in 13, so I would expect it to work on the Forerunner 235.

Am I missing something?

Many Thanks,

R.
  • On a 230/235 the menu is a long press on the up button, and to catch it, all you have to do is "onMenu()" in your BehaviorDelegate.

    and when checking keys,

    function onKey(evt) {
    if(evt.getKey()==Ui.KEY_UP) {
    }
    }

    gets you the up key.

    for touch devices, I use swipe left and swipe right in place of key_up and key_down, but onMenu works the same.
  • if( evt.getKey() == Ui.KEY_MENU ) {

    Can't that work? I don't catch the Up key.

    Btw - onkeypressed and onkeyreleased works as expected?
  • Thanks

    Thanks for the replies. The long press was what solved the problem for the user. I will refactor my code when I get a chance, as the suggestions are more elegant.

    R.