Fullscreen data field - how?

I know this was discussed probably too many times already but here we go again... I'm creating a data field and I want to display data in a fancy way when full screen and as simple as SimpleDataField otherwise. I would think of two approaches:

1) Require field to be full screen only (like some Garmin chart data fields), or

2) Switching between DataField and SimpleDataField depending on the layout.

I know both are not possible from what I have already read. So.. My question would be what tricks do you guys use to "emulate" a SimpleDataField layout? And is there an open source code for SimpleDataField to look at?

  • 1. is kind of possible. You can't enforce it, but look at datafields like GRun. You can add it anywhere, but you'll only see the top part of it, because it draws everything based on the screen size and not what dc.getWidht(), getHeight() return. So the user sees it and understands it needs a full screen layout.

    As for emulating SimpleDataField in DataField. I wasted lot of time on it. Created scripts that generate a file of constants based data in each device's simulator.json and compiler.json. It doesn't work good enough for me to publish it in github...

    If you don't care about the field's label being different, or don't want a label then the easiest thing is to use dc.fitTextToArea and start with FONT_LARGE (aka 4) and decrease the font size until it reaches a value when the text to be displayed fits in the area or reaches 0. Of course it's not always easy to know what is the area, 'cause most watches are round and most field positions have some round edge... Ah, and if you only display numbers then you can start with FONT_NUMBER_THAI_HOT (8), but on certain devices the number fonts don't even have space, so be careful with it.

  • Keep it as a Complex Data field, and decide how you want things to look based on the dc's width, height, and obscurity flags.

  • Created scripts that generate a file of constants based data in each device's simulator.json and compiler.json. It doesn't work good enough for me to publish it in github...

    Please do. I don't get why Garmin does not do it for us as a part of SDK. It's like.. very basic scenario. I have started doing the same thing that you do and discovered that a simulator and actual device have different fonts/sizes. So if I want "pixel perfect" feel and look I need all the physical devices I want to support.

    I also got to the point of decreasing the digits font, having label always be XTINY. But again I feel it is very common routine, not provided as a part of SDK.

  • Yeah, I get it. My question was more about a lot of devs are trying to solve the same common problem. Is there open source/reusable code/SDK calls/etc rather than everyone implements it on their own.

  • I started with CIQ back in 2015 and have done a whole bunch of apps of all different types.  I'll say that I solved this in all apps, and I doubt the same way in any two.  It's about the app and it's look and feel, and the specific data involved

  • I know you're legend of this forum, no kidding. I learned so much just reading your answers. I also appreciate every app is different. But what I'm curious about is 3rd party implementation of SimpleDataField with just a label and a single metric so that if on a specific layout I don't want anything but those two then I don't need to reinvent the wheel. But at the same time on a full screen layout I can do my own customization with more than just two texts.Well I guess there's no workaround. And it feels frustrating to me that Garmin does not offer a solution other than figure it out on your own.

  • Much in CIQ is your own thoughts and code.

    Why wait for a 3rd party or Garmin when you easily do this on your own?

  • It doesn't look "easy" if I want to make a field that matches the native field. Many devices, many layouts. How, for example, do I get Y offset (aka locY) of a metric name label for fenix8 in 3A layout for field #3? I get I can do (dc.getHeight - xtinyHeight - numberHeight) / 3 which will give me 2 labels equally spaced vertically in dc. But will it match the field next to it? I guess no.

  • Here's the basics.

    In onLayout, get the height of the dc with dc.getHeight, then starting with font=4 (for the largess alpha font) use dc.getFontHeight, looking for the first one where you can use two lines in the height of the dc. If you get to font==0, that's the smallest possible.  Number fonts are a bit trickyer due to the possible white space.  Start with font=8 and stop when font==5

    Using System.screenHeight you can use the dc's height to determine something like a full screen field

  • The label position and font size can be extracted from simulator.json. The problem is it doesn't always fit the real device. I.e on edge devices the label font used by the system is different size from any of the FONT_ constants.