Stupid complications questions

Hello,

Before I head down the path of complications, please verify:

1) It's not that drastic to convert/publish my Glance as an app 

2) I can open my own app using a long press on an area of my compatible watch face

It looks a bit daunting from my amateur programmer seat.

Thanks

  • Yours works...of course.  Mine...

    Am I required to check coordinates for the onPress to work?  I do not see it in the documentation.  I copied and pasted your file to the end of mine.  Changed the class name to match mine, deleted the if statement, so that I am left with:

    class tempViewDelegate extends WatchUi.WatchFaceDelegate
    {
    var view;
    function initialize(v) {
    WatchFaceDelegate.initialize();
    view=v;
    }

    function onPress(evt) {
    Complications.exitTo(view.stepId);
    return true;
    }
    No love.  If i'm inferring correctly, the "v" in "function initialize(v)" is the inherited view that this is a delegate of.  Otherwise, I need to define "v" elsewhere.
    Amateurs are needy
  • V is passed to the delegate.  It's the view.  See getInitalView in the AppBase.  You don't need to check the location of you want onPress anywhere on the screen, but I usually launch different things based on where the screen is pressed.  One place steps, another heart rate for example

  • Thanks! I figured something like that (the documentation assumes a higher level of knowledge than I currently have).  The location checking is eventually in the goal.  I'm just working on stepping up the complexity.  If you look at my whole temp program, there's no "safety checks" in it.  I'm just going for the one watch, one thing to work. 

    Which it isn't.

    Yet.

  • That was it!  I was only creating/returning the single view in the initialization and not the delegate view, too.

    Wow.  

  • I'm back! I got a bare bones watch face w/ complications to work (Thanks again jim_m_58...It's a lot of your code deleted out and a bit of mine added), but when I moved what I thought I learned into my watch face, I'm getting an error I cannot get cleaned out.

    Complications.registerComplicationChangeCallback(self.method(:onComplicationChanged));
    kicks out the error:
    Could not find method onComplicationChanged on object $.myWatchFaceView
    I have to do a callback to each complication
    Complications.registerComplicationChangeCallback(stepId);
    Complications.registerComplicationChangeCallback(batId);
    Complications.registerComplicationChangeCallback(calId);
    to get it to work.  Thoughts?
    Thanks
  • Here's some code from one of my watch faces that can have 5 complications:

        if(compCIQ!=null) {Complications.subscribeToUpdates(compCIQ);}
        if(compSteps!=null) {Complications.subscribeToUpdates(compSteps);}
        if(compPushes!=null) {Complications.subscribeToUpdates(compPushes);}
        if(compBat!=null) {Complications.subscribeToUpdates(compBat);}
        if(compLeft!=null) {Complications.subscribeToUpdates(compLeft);}
        
        Complications.registerComplicationChangeCallback(method(:compChanged));

    I subscribe to each

    and then register once

  • That returns the same error.

  • Notice compChanged is a call back.  When you register, what are you passing?

        function compChanged(id) {
            if(id.equals(compSteps)) {
                ...
            }
            ...
        }

    with the code I posted, for example,,,

  • Hmm.  I added a hasComps check in-line with my existing code, versus a function to handle all.  I see how yours references the function to check/use all of the complications in 1 place.  So, it appears I need to change the entire structure of my code or just leave the individual handlers.

  • You can only have one handler.  Everything you subscribe to uses the same handler.  Notice the "if" I have for the callback being for steps