BehaviorDelegate.onBack is not called when progress bar is active on fr735xt

Former Member
Former Member
Is it possible to use ProgressBar class as default view?

In this call:

// Return the initial view of your application here
function getInitialView() {
return [new ProgressBar("Waiting", null), new SomeDelegate() ];
}

If possible - what should be passed as SomeDelegate? How should it be implemented? Anything specific?
  • You can not a native view as the initial view. View types that are incompatible with Ui.switchToView() are incompatible with getInitialView(). The documentation for Ui.switchToView() covers this topic.

    As for what the delegate used with a ProgressBar should look like, you just need to provide something that inherits from Ui.BehaviorDelegate. The onBack() method will be called if the user presses the back button. None of the other delegate functions are used. This is mentioned in the documentation for the Ui.ProgressBar.

    Travis
  • Former Member
    Former Member
    You can not a native view as the initial view. View types that are incompatible with Ui.switchToView() are incompatible with getInitialView(). The documentation for Ui.switchToView() covers this topic.

    As for what the delegate used with a ProgressBar should look like, you just need to provide something that inherits from Ui.BehaviorDelegate. The onBack() method will be called if the user presses the back button. None of the other delegate functions are used. This is mentioned in the documentation for the Ui.ProgressBar.

    Travis



    OK

    I have created custom View which is absolutely default.

    function getInitialView() {
    return [new StartupView(), new StartupDelegate()];
    }

    class StartupDelegate extends Ui.BehaviorDelegate {

    function initialize() {
    BehaviorDelegate.initialize();
    }

    function onMenu() {
    return true;
    }
    }


    Inside onStart I call Ui.pushView with parameters: new Ui.ProgressBar("Waiting...", null), new WaitingDelegate()
    It is indeterminate progress bar... Delegate is the following:

    class WaitingDelegate extends Ui.BehaviorDelegate {

    function initialize() {
    BehaviorDelegate.initialize();
    }

    function onBack() {
    Ui.popView(Ui.SLIDE_IMMEDIATE);

    return true;
    }
    }



    When progress is displayed I cannot close progress bar view.
    It works fine in simulator but not on real watch.
    Progress is always displayed.
    It is tested on 735XT.
  • I'm not sure what is going on, but this sounds familiar to some stuff I've seen in the past. I'll look through my history to see if I can find anything..

    Have you tried just returning false from WaitingDelegate.onBack() (or not providing an implementation). The default behavior of the system is to pop the top view if the back key is pressed, so this should work out as well.

    Travis
  • Former Member
    Former Member
    Have you tried just returning false from WaitingDelegate.onBack() (or not providing an implementation).


    Yes..
    In simulator it shows me initial view (which is blank).
    After next press on Back button I can close app in simulator.

    But in real device it does not react on button press.
  • o A Descriptive Title (i.e. “Simulator Freezes Launching App in Eclipse”)
    BehaviorDelegate.onBack is not called when progress bar is active on fr735xt

    o The Environment:
    fr735xt (7.10 firmware http://www8.garmin.com/support/download_details.jsp?id=10061)
    Eclipse Neon.1 (4.6.1)

    o A detailed description of the issue
    BehaviorDelegate.onBack() is not called when showing a progress bar on fr735xt. Unless the application implements some other system to dismiss the progress bar, the only way to dismiss the progress bar is to reboot the device. The source below uses a timer to automatically dismiss the progress bar after 30 seconds.

    o Steps to reproduce the issue
    • Build the source code below into an application.
    • Deploy that application to the fr735xt
    • Optional: create the log file so you can verify the appropriate functions are called.
    • Start the application on the device. You should see the Press Menu in white text on a red background.
    • Press menu (i.e., hold the Up button for a few seconds). You should see a progress indicator and the text 'Waiting...'.
    • Press back to cancel the progress indicator. You should be returned to the view seen in step 4, but that is not what happens; the key input is ignored.
    • Wait thirty seconds and the application will automatically return to the initial view.


    o Any applicable additional information
    The log file doesn't indicate that onBack() is ever getting called.

    App.initialize
    App.onStart
    App.getInitialView
    StartupView.initialize
    StartupDelegate.initialize
    StartupView.onShow
    StartupView.onUpdate
    StartupView.onUpdate
    StartupView.onUpdate
    StartupDelegate.onMenu
    WaitingView.initialize
    WaitingDelegate.initialize
    StartupView.onUpdate
    StartupView.onHide
    WaitingDelegate.onTimer
    StartupView.onShow
    StartupView.onUpdate
    StartupView.onUpdate
    StartupView.onUpdate
    StartupView.onUpdate
    StartupView.onHide
    App.onStop


    This is what I see when executing the above steps in the simulator..

    App.initialize
    App.onStart
    App.getInitialView
    StartupView.initialize
    StartupDelegate.initialize
    StartupView.onShow
    StartupView.onUpdate
    StartupDelegate.onMenu
    WaitingView.initialize
    WaitingDelegate.initialize
    StartupView.onHide
    WaitingDelegate.onBack
    StartupView.onShow
    StartupView.onUpdate
    StartupView.onUpdate
    StartupView.onHide
    App.onStop


    o A code sample that can reproduce the issue (in email only if preferred)
    using Toybox.Application as App;
    using Toybox.WatchUi as Ui;
    using Toybox.System as Sys;
    using Toybox.Graphics as Gfx;
    using Toybox.Timer as Timer;

    class WaitingView extends Ui.ProgressBar
    {
    function initialize() {
    Sys.println("WaitingView.initialize");
    ProgressBar.initialize("Waiting...", null);
    }
    }

    class WaitingDelegate extends Ui.BehaviorDelegate
    {
    hidden var _M_timer;

    function initialize() {
    Sys.println("WaitingDelegate.initialize");
    BehaviorDelegate.initialize();

    // automatically dismiss the progress bar after 30 seconds to avoid
    // the need to reboot the device to resolve the situation
    _M_timer = new Timer.Timer();
    _M_timer.start(self.method(:onTimer), 30000, false);
    }

    function onBack() {
    Sys.println("WaitingDelegate.onBack");

    _M_timer.stop();
    _M_timer = null;

    return false;
    }

    function onTimer() {
    Sys.println("WaitingDelegate.onTimer");

    _M_timer.stop();
    _M_timer = null;

    Ui.popView(Ui.SLIDE_UP);
    }
    }

    class StartupView extends Ui.View
    {
    function initialize() {
    Sys.println("StartupView.initialize");
    View.initialize();
    }

    function onUpdate(dc) {
    Sys.println("StartupView.onUpdate");
    dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_RED);
    dc.clear();

    var cx = dc.getWidth() / 2;
    var cy = dc.getHeight() / 2;

    dc.drawText(cx, cy, Gfx.FONT_SMALL, "Press Menu",
    Gfx.TEXT_JUSTIFY_CENTER | Gfx.TEXT_JUSTIFY_VCENTER);
    }
    }

    class StartupDelegate extends Ui.BehaviorDelegate
    {
    function initialize() {
    Sys.println("StartupDelegate.initialize");
    BehaviorDelegate.initialize();
    }

    function onMenu() {
    Sys.println("StartupDelegate.onMenu");
    Ui.pushView(new WaitingView(), new WaitingDelegate(), Ui.SLIDE_UP);
    return true;
    }
    }

    class BytesApp extends App.AppBase {

    function initialize() {
    Sys.println("App.initialize");
    AppBase.initialize();
    }

    function onStart(params) {
    Sys.println("App.onStart");
    }

    function onStop(params) {
    Sys.println("App.onStop");
    }

    function getInitialView() {
    Sys.println("App.getInitialView");
    return [ new StartupView(), new StartupDelegate() ];
    }
    }
  • Former Member
    Former Member
    Thanks for all the work. I've created a ticket.

    Thanks,
    Coleman
  • Former Member
    Former Member
    What is status for this bug?

    It does not look like something fixed.

    It is blocking for us.. We cannot use progress in our app.
  • Former Member
    Former Member
    Hey,

    Thanks for checking back in. I did a little digging for you today. This is something going on with the device software and is now assigned to fixed on another team. I'll try to push a little and see if I can get some more movement. So there is no confusion, an SDK update will not be the fix for this one. It's going to be a device software update. I'll try to keep you posted.

    Thanks,
    -Coleman
  • Former Member
    Former Member
    I got word that this issue has been addressed and will be implemented in an upcoming software release.

    Thanks,
    -Coleman