Menu view popping (in sim)

My app has the app view -> menu view 1 -> menu view 2

For the Edge 1000 (a CIQ 2.4 device), in the simulator clicking the back button in menu view 2 pops all the way back to the app view.

For the Edge 1030 (a CIQ 3 device), in the simulator clicking the back button in menu view 2 pops back to menu view 1 (as expected).

Is the 2.4 issue a general one or is it just in the simulator?

  • Try this:
    - Push the second menu after makeWebRequest (in the same execution thread/context), not in the callback. This should avoid your problem with the first menu automatically popping itself or whatever
    - Use a state variable to determine whether makeWebRequest has finished. i.e. Set to false before request, set to true in callback
    - When the second menu is initially displayed, if makeWebRequest is still active, push a progressbar immediately. This can be a "busy-wait" progress bar with text like "Loading" or whatever. Set a 2nd state variable to signify that the progressbar was pushed
    - In the makeWebRequest callback, if the progressbar was pushed, call WatchUi.popView()


    I have to create the second menu in the callback (the menu displays the data the callback gets).

    Here's what I ended-up doing...

    After makeWebRequest, create progress view.
    In the callback, pop the progress view and create the second menu.

    The automatic popping is a feature of Menu. The way to fix that is to push the menu again before creating the second menu (the submenu).

    Menu2 allows you to nest menus/views. Menu doesn't (unless you fake it, by pushing the main menu before pushing the submenu).

    EDIT: I don't even think you need the dummy view. You could probably just drive all of this from the first menu, with a state variable (which the dummy view would need anyway), since you need to push a progressbar anyway.

    You don't need the dummy view. The progress is sufficient.

  • Great, glad it’s working now. Your solution is certainly simpler. I thought you implied part of the problem was pushing anything at all in the callback, which is why I suggested something more complex. But perhaps I read too much into what you posted before.

    For the record, my suggestion was to store the data received by the callback in a shared location, so the first menu would be able to access it. But it doesn’t matter since you found a better, simpler solution anyway.
  • Thanks for your help (both of you).

    I didn't expect the two menus type would have different behavior here.

    (Now, I have to figure out how icon menus work.)
  • Former Member
    Former Member over 4 years ago in reply to jim_m_58

    Hi Jim 

    In my application, (NordicThingy52)  i am using onMenuItem.

    How to get the item value in order to use it into another class

    I tried callback method (item.invoke) but it doesn't work

    function initialize( delegate, profileManager, device ) {
    var Smd = new ScanMenuDelegate();
    var item = Smd.method(:onMenuItem);
    Sys.println(item instanceof Method);

    Thanks a lot for your help

    BR

  • Former Member
    Former Member over 4 years ago in reply to Former Member

    Hi there Solved by using of the module approch

    Regards