Guys, I am tinkering with mobile development in Delphi 10, and I have a question about resolutions on mobile devices. I have 2 devices here, one older tablet that is 800x480, and my phone that is 1440x2560.

Guys, I am tinkering with mobile development in Delphi 10, and I have a question about resolutions on mobile devices. I have 2 devices here, one older tablet that is 800x480, and my phone that is 1440x2560.
Now, on the tablet, for some odd reason my FM application reports the resolution at 1066x592, and on my phone it reports as 640x360.
Now I assume that on my phone it just runs in a form of HiDPI mode, but on the tablet, it is causing lines to be completely missing. How do I correct this situation on the tablet? The real resolution is 0.75 of what FM reports it to be.

Comments

  1. Hi. The code is nothing special really.
    For getting the resolution I just used this code:

    ShowMessage('Resolution: ' + IntToStr(Screen.Size.cx) +
    'x' + IntToStr(Screen.Size.cy));

    I am not controlling or setting resolution anywhere, the application is basically just a bare form with a rectangle in it.

    If I use the FM components though, they show just fine or at least appear to show fine, but when custom drawing a rectangle, it's way off because the resolution that the application uses, doesn't match the real resolution.

    Rect := TRectangle.Create(Self);
    Rect.Parent := Layout1;
    Rect.Width := 100;
    Rect.Height := 100;
    Rect.Position.X := 100;
    Rect.Position.Y := 100;

    Can't get it any simpler than that. What am I missing?

    ReplyDelete
  2. AFAIK Screen.Size is size based on your device dpi, it seems that your tablet is ldpi device.

    ReplyDelete
  3. Dalija Prasnikar I think you are right. I have been reading up on the inner works of firemonkey and it appears it is designed to be in 160dpi. Since my screen is obviously ldpi, that means it is in fact 120dpi. 120/160 = the 0.75 factor that i am witnessing, and explains why firemonkey forces the weird 1066x592 resolution instead of the real 800x480 resolution.
    So I guess the short version of it is that I can't do anything about this then at this time. Shame.

    ReplyDelete

Post a Comment