Access to location of label for SimpleDataField

When you implement a SimpleDataField, you get the label for the field almost for free by setting the variable "label" in the initialize method.

But if you want anything more complicated than a text string, then you have to use a "plain" DataField, and therefore also have to draw the label yourself.

This is easy enough for the various square watches but for the fenix3, it becomes rather difficult as the watch is round and you therefore cannot just place the label in the top-left corner of the data field. If you look at the simulator, you'll see that the label is centered, and the top-most data field is made a bit smaller.

I could see a couple of solutions:

  • The position and justification to use for the label could be made available.
  • WatchUi.DataField could add a simple method drawLabel(label) that will draw the label and return the bounding box so we know what space is left for the rest of the data field.
  • Here's a complex DF that's just over 10k, and it's more complex than some others.  I change the title, based on info from a background service that uses BLE, and based on obscurity flags,  might shift things up/down/right or left.

  • Can you show a screenshot of the same device, layout, but with the data only being "3:56"? And also on some edge device?

  • 3:56 is the time the background ran.  Not sure what you are looking for.  I might user a larger font with only two lines, but this DF shows 3 lines. And it's just one I wrote for my own use.

  • I'm looking for an easy way (similar to SimpleDataField) to set a label (dynamically), set the data from compute, to display the data with the biggest possible font, and that the whole thing looks as close to the SimpleDataField (or the other default text-only datafields provided by Garmin on the device, i.e: speed, time, distance, steps...)

    The whole reason I went down this rabbit-hole is because I saw on Edge devices a very different layout, that "jumps" when you look at the screen, so I tried to create the same look, but using DataField (because I need to change the label dynamically).

  • I'm unclear on your issue.  With a complex DF, the title is really just another line of data.  Granted on some devices and some layouts, the title isn't displayed at all for a simple data field.

    Are you using layouts or dc calls to display things?  With dc calls, changing sizes it pretty easy can can be done based on the size of the dc.  Here I'm now using 3 different fonts

  • I'm using dc calls. I want a class that behaves "exactly" like SimpleDataField plus it has setLabel(string)