datafield touch

Hi,

Is it possible to receive an Input in DataField on Garmin watches ? I saw some old posts where apparently onTap() was working but I It doesn't seem to work in my FR965 Simulator. I wanted to build a datafield where with simple tap i can cycle through and select and item and then write that value to FIT file. But i'm stuck in receiving inputs in datafield.

  • I need to test this, but maybe you have?

    isTouchScreen = true if the device has a touchscreen and it is not disabled.

    For an EDGE device, I wonder if that would = false on an EDGE 1040 if we went into the Display Settings, turned off Screen Capture, and used the Power Button tap to lock the touchscreen like we do in the rain. But the touchscreen still works for screen swipes, just not for taps? Is that considered "disabled" - because I don't know of any other disable control.

    For watches like our FR955s, I wonder if isTouchScreen would indicate if it responds to onTap() or not? It is a touchscreen device, but CIQ only recognizes the screen via onTap() so maybe?

  • Hey Piotr, would you please share the working code snippet? I'm trying to get onTap() for data field for epix2 (which is CIQ 5.1) and I can't make it work on both simulator and actual device.

    function getInitialView() as [Views] or [Views, InputDelegates] {
    var view = new MyView();
    var behaviorDelegate = new MyBehaviorDelegate(view);

    return [ view, behaviorDelegate ];
    }

    ...

    import Toybox.Lang;
    import Toybox.WatchUi;

    class MyBehaviorDelegate extends WatchUi.BehaviorDelegate {
    var myView as MyView;

    function initialize(view) {
    // I see this printing on device
    System.println("Initializing delegate");
    myView = view;
    BehaviorDelegate.initialize();
    }

    function onTap(clickEvent as WatchUi.ClickEvent) as Lang.Boolean {
    // Never get into here
    System.println("Tap event received");
    myView.onTap(clickEvent);
    return true;
    }
    }
  • Is touch enabled? Can you SE touch is working for another DataField?

  • I'm trying to get onTap() for data field for epix2 (which is CIQ 5.1) and I can't make it work on both simulator and actual device.

    onTap() only works in complex data fields, not simple data fields (at least for watches. idk what the situation is for edge devices and handhelds)

    (idk which one your app is, but that's the only thing I can think of)

  • Touch screen seems to be enabled, I can swipe between DF screens, also

    System.println("Touch screen: " + System.getDeviceSettings().isTouchScreen.toString());

    gives true when running on device. And this is also "complex" data field:

    class MyView extends WatchUi.DataField {

    Well, I incline to think they don't support it for the model maybe?

  • but then isTouchScreen should have returned false according to the docs

  • For watches like our FR955s, I wonder if isTouchScreen would indicate if it responds to onTap() or not? It is a touchscreen device, but CIQ only recognizes the screen via onTap() so maybe?

    This has come up before and the short answer is probably not.

    What you would have to do is find an instance of a device / firmware which doesn't support onTap() for data fields and returns false for isTouchScreen when the touchscreen is enabled. If you really think about it, the real place to look at is old devices / firmware which don't support onTap(), not new devices / firmware which do support onTap. Or at best, look for newish devices / firmware which don't support onTap - like epix gen 2 mentioned above.

    The medium-length answer is:

    - if you really stop and think about it, even Garmin did what you want (change isTouchScreen to indicate support for onTap()), the utility would be very limited. They can't and won't change old devices / firmware (which don't support onTap()), and for newer devices / firmware which do support onTap(), how would you tell the difference? If the touchscreen is enabled, onTap() will work, and if the touchscreen is disabled, onTap() will not work.

    [1/4]

  • The longer answer is:

    - given that the simulator and older watches / firmware which don't support onTap for CIQ data fields are known to return true for DeviceSettings.isTouchScreen [when the touchscreen is enabled), it wouldn't be practical or helpful for newer watches which support onTap() to start returning false for isTouchScreen in some limited scenario where the touchscreen is actually enabled but a given CIQ data field wouldn't be able to respond to onTap. The only 2 scenarios I can think of would be:

    -- the data field is a simple data field

    -- the data field doesn't have an input delegate

    Would you really want DeviceSettings.isTouchScreen to depend on either of those things? Would kind of put a lie to the class name of "DeviceSettings".

    [2/x]

  • - it's not really conceivable that Garmin would release some newer watch / firmware which didn't support onTap() at all for CIQ data fields, but changed the return value of isTouchScreen to false to indicate that onTap() is not supported, as that would be a significant change from how it worked before

    - the class is literally called DeviceSettings, and the documentation for isTouchScreen says:

    true if the device has a touch screen and it is enabled in settings, otherwise false

    I think it's worth taking Garmin at their word here. [Indeed that's how it's always worked in the past afaik.]

    - even if I'm wrong about the previous 3 points, it would still be impossible to rely on the value of isTouchScreen to detect onTap() support anyway, since it doesn't work that way for old devices. At best you could use a value of false to determine that onTap() is *not* supported, but a value of true would never give you any useful information about whether onTap() *is* supported.

    [3/x]

  • I can also tell you that FR955 [with updated firmware that supports onTap] works just like older devices/firmware which don't support onTap(): when the touchscreen is enabled, isTouchScreen is true, and when the touchscreen is disabled, isTouchScreen is false.

    Again, this is indistinguishable from the previous behaviour. And again, this doesn't really answer your question, because I don't have an FR955 which *doesn't* support onTap() so I can't tell you whether isTouchScreen would be false all the time [for data fields] in that case. But again I would have to say probably not, since that's not how it worked for past devices.

    I can't imagine Garmin changing isTouchScreen to be always false on an early version of FR955 which doesn't support onTap(), simply in anticipation of the fact that FR955 would later support onTap. I also can't imagine Garmin releasing a new touchscreen device that doesn't support onTap *and* returns false for isTouchScreen all the time [for data fields]. Again, what would be the point?

    There's already a bug report / feature request which mentions that it would be nice to be able to detect onTap() support for data fields at run time. I think expecting isTouchScreen to somehow fulfill that role is a deadend, unless you want Garmin to go back in time and update all the old devices / firmware to make isTouchScreen work that way.

    As I alluded to above, FR955 didn't support onTap for data fields at release. Assuming that it worked exactly the same as older / other devices with regards to isTouchScreen, it's another example of why it's not possible in principle to expect isTouchScreen to reflect onTap support.

    [4/4]