Full screen datafield - how to check for screen layout and number of DataField fields

Hi new developer here - I want to make a DataField that is full screen (1 data field) only. Do I need to check if user tries to use it on a screen with more than one datafield displayed? Will the watch crash if I don't check? Should I give the user a warning that it's for a single datafield screen only? And is the way to check using dc.getWidth()?
Thanks!
  • Some devices only have a fixed number of DFs, like the vivoactive (always 3), and for those with a variable number, you probably just want to insure the width/height will work for your data.

    and then, you need to consider a bit more if you're on a round watch..
  • Thanks for that - so it won't crash, it just won't display properly? Can anyone else add anything to this?
  • Yes, you can use the dimensions of the Dc and other device attributes to be reasonably sure you are looking at a full-screen data field.

    If you render things in fixed locations and the size/shape of the data field Dc is different than what you've coded for, it will not (should not) crash the device, it will just look really bad.
  • Former Member
    Former Member over 9 years ago
    You could also check the obscurity flags.
    Based on what is or is not obscured you can determine what kind of datafield you're dealing with.

    Snippet from HrZonesField, not made by me.

    var obscurity = getObscurityFlags();
    if (obscurity == (OBSCURE_LEFT | OBSCURE_TOP)) {
    minX += dc.getWidth() * 0.10;
    minY += dc.getHeight() * 0.16;
    } else if (obscurity == (OBSCURE_RIGHT | OBSCURE_TOP)) {
    maxX -= dc.getWidth() * 0.10;
    minY += dc.getHeight() * 0.16;
    } else if (obscurity == (OBSCURE_LEFT | OBSCURE_BOTTOM)) {
    minX += dc.getWidth() * 0.20;
    maxY -= dc.getHeight() * 0.25;
    } else if (obscurity == (OBSCURE_RIGHT | OBSCURE_BOTTOM)) {
    maxX -= dc.getWidth() * 0.20;
    ... etc. ...
  • Of course, but obscurity flags can't tell you how many data fields are present in the current layout or if a data field is being used as the only data field on the screen.
  • Thanks guys - yes I've seen that code before for the obscurity flags - I wonder how the scaling factors were determined, 0.1, 0.16 etc. I'm guessing trial and error, or perhaps using a graphics program which shows pixel locations for a Fenix round display...