How to get out of nested menus

I'm trying to use the built-in menus and confirmation dialog to implement resume/save/discard functionality. I have this working for the most part, but I do have one issue. If, when the resume/save/discard menu is presented, the user selects Discard, and when the confirmation dialog is presented, they select Yes, I want to get out of the menu completely. Technically, I want to exit the application.

In the simulator, calling Ui.popView(Ui.SLIDE_IMMEDIATE) for every menu in the stack seems to work just fine. On the device (a fr920xt) the additional popView() calls don't appear to do anything (when confirming the discard you end up at the resume/save/discard menu).

Does anyone know how to handle this? Am I trying to work around a ConnectIQ bug specific to the 920? Is what I'm trying to do just not supported by the menus?

Travis
  • Former Member
    Former Member over 10 years ago
    Menus will automatically pop themselves if you do not explicitly do something different in their callback functions. The simpler native views (confirmation, number picker) always pop themselves.

    When you pop multiple pages in a row, the show/update/hide sequence you outlined isn't necessary for intermediate views, but I am pretty sure they all run in the current hardware implementation. This is what prevents animations from working properly as I mentioned. If the fixes for this go in the way I currently have them imagined, then you would not get show/update/hide calls all the way down the stack. You would transition directly from the last view that was visible to the new top of the view stack. Since this isn't really at the implementation stage yet, I don't know for sure what will happen.
  • So the posted code works 'correctly' on the new 3.20 firmware for the 920xt. You see them appear and disappear as they are popped from the view stack, but it at least behaves like I'd expect.

    Travis
  • Former Member
    Former Member over 10 years ago
    I have tried something similar on my vivoactive and it does not seem to work. I have a main view, then I load up another view, which then loads up another one.. If I press the ENTER button, I run code that calls two popView which in theory should remove the 3rd, and 2nd pages leaving me with the Main view. On the simulator that works fine, but on my watch, it only seems to pop the 3rd view and takes me back to the 2nd view.
  • Former Member
    Former Member over 10 years ago
    My solution to a similar problem ended up being a global flag. I place a flag conditioned popView call at the start of onShow.
  • Former Member
    Former Member over 10 years ago
    My solution to a similar problem ended up being a global flag. I place a flag conditioned popView call at the start of onShow.


    Thanks SHARKBAIT, that has solved my issue for now
  • Former Member
    Former Member over 10 years ago
    It looks like the VivoActive did not have the fix for this issue pulled in at their last release (2.60). It should be corrected in the next available device update.