Button navigation

Thanks JIM!! Turns out that user interaction in a DATA FIELD is absolutely supported. I have an EDGE 820 with a touch screen and the SELECTABLE example works well.

However, I want to also support devices like a 520 that does not have a touch screen. And the SELECTABLE example doesn't work well. So I have some basic questions for those who have worked with buttons.

The EDGE 520 has up/down, lap/start, back, power/light, and select butttons.

Q1: Once I call the User Interaction delegate to present checkboxes.... Can I override the buttons so, for example, the STOP/START button will be trapped to trigger my own User Interaction functions, rather than trigger the native device action to STOP/START the running activity? Then when I exit the User Interaction logic, the buttons return to their normal default behavior?

Q2: What is the standard method to switch screens? Emulate a SWIPE right/left with buttons? Maybe use the "power/light" button to scroll thru the user input screens if more than one? Or add a "Next Screen" object on the bottom of the screen to pick and select with up/down and select buttons?

I assume the "up/down" buttons are best used to move from checkbox to checkbox within a screen? The "select" button to then check or uncheck the checkbox that has the cursor? The "back" button to exit User Interaction?
  • You can't use hard or screen based buttons in a data field. Only onTap() and then only on some touch devices
  • Are you still talking data field? I don't believe you can intercept any button presses in a data field. It wouldn't make much sense. If you have more than one data field, which one would get the input? If you allowed multiple data fields with input, which would get it first? That would introduce all sorts of issues. Sure you might have a single field screen, but there is no guarantee of that. I wasn't aware the touch screen worked as you suggest but that does make more sense. I'm guessing you only get touch notifications for the areas over your data field.
  • Darn - you're right, of course. I changed the SELECTABLE example's code to a datafield type... but forgot to change the manifest from watch type to datafield type. So checkboxes worked in the simulator. The simulator doesn't tell you if you are running a watch-face, widget, app, or datafield, Once I fixed the manifest file, the checkboxes no longer worked. Oh well.

    To jim's point, I can use hard buttons in a datafield... For example, I do something if the LAP button is pressed twice within a couple seconds. Kind of a kludge, but it works.

    To ekutter's point - my DFs are designed to be and only run in full screen mode (1 DF on the screen). So in that case, tapping the screen to trigger a set of checkboxes for the user to make on-the-fly changes to the behavior of the DF would be nice. Rather than opening up one's phone during an activity to get to User Settings. I get that a DF isn't designed for that kind of interactions. A widget might be the way to go.
  • I assume when you "do something if the lap button is pressed twice" you are actually just looking at the onLap message rather than getting this from a behaviorDelegate?

    My point about the single field was that there is nothing in CIQ that gives single field data pages special privileges. But even in the case of single field pages, the underlying navigation code still needs to deal with screen touches such as bringing up a menu or swiping to the next page. Taps could be handled differently to certain parts of the screen, but it still could get messy. And you have some devices like the 1030 with big screens and some like the VAHR with fairly small screens. Again, could get messy.
  • I changed my code to detect a quick STOP/START button combo, using the onStop/onStart. Since it is not uncommon to use the Lap button, but it is uncommon for someone to quickly stop and restart an activity.

    If there was a way for a DATA FIELD to detect an onTap and return where on the screen that tap occurred, that would be fantastic. But it does not look like data fields allow for this. One simple example. I'd like to track nutrition bottles consumed during an ultra cycling ride or race. Here are use cases:

    1. After each hour of Moving Time, I pop up a notice to myself that I should have drained a bottle. I tap on the "YES" box if I have (or will) finish a bottle. Or NO if I am not ready to drain it yet.

    2. If I've drained a bottle before the time based alert, I tap on the CALORIES portion of my full screen data field, and that generates the YES or NO display confirming that I've finished a bottle. If I tap on the YES box, then that increments my bottle counter and resets the one hour timer for the next alert.

    IF YOU KNOW HOW TO GET onTap() with screen coordinates to work in a DataField, I'll Amazon Prime you a 6 pack of your favorite beer :-) [Update: applies to the first to solution this, not everyone LOL]
  • You simply add an input delegate with onTap().

    The only input allowed for a DF is onTap(), and then only on some touch devices. Look at the input sample in the SDK.

    The evt passed to onTap() is a click event, with the screen coordinates.
  • Yes. The touch-based edge devices support onTap(). This functionality has been there for a few years. here.
  • Travis - I compiled your "improved" code sample from that link. It works perfectly on the Edge 1000 and 1030!! But for some reason, it does not increment/decrement on the 820. I will debug the code - maybe just a simple screen geometry issue? Anyway, THANK YOU!!


    Ok - this is a SIMULATOR BUG. I compiled it for my Edge 820 and it works on the device, but not in the SIMULATOR for the Edge 820. It also works on the EXPLORE.
  • Yes, there's a bug in the sim with the 820. See https://forums.garmin.com/forum/developers/connect-iq/connect-iq-bug-reports/1424146-no-inputdelegate-in-simulator-on-edge-820-explore-with-sdk-3-0-4

    Are you using 3.0.5? If not maybe try that and note the result in the bug report.
  • I tried - still broken in 3.0.5. I've updated the bug report - well that forum link you provided (is that the formal bug report?).