Page 1 of 1

[seen other way] DesktopScaledX() should return a double

Posted: Thu Jul 14, 2022 9:45 am
by Olli
Hello,

trying to hold the dpi awareness (just an InputRequester() does not give the normal display : I must switch the DPI awareness option on, to restore the right display - v5.73 LTS x64 demo), I observe DesktopScaledX() returns an integer.

Code: Select all

Debug DesktopScaledX(1) ; returns 2 (it should return 1.75 on my computer)
Debug DesktopScaledX(100) : returns 175 (ok)
Would it be possible to return a double value ?

Re: DesktopScaledX() should return a double

Posted: Thu Jul 14, 2022 10:16 am
by NicTheQuick
+1

Re: DesktopScaledX() should return a double

Posted: Thu Jul 14, 2022 3:16 pm
by Caronte3D
+1

Re: DesktopScaledX() should return a double

Posted: Thu Jul 14, 2022 8:56 pm
by Olli
Uw... Indeed, it is perhaps not to Fred I should write this to, but Microsoft... :shock:

Re: DesktopScaledX() should return a double

Posted: Thu Jul 14, 2022 9:14 pm
by mk-soft
Not needed ...

Code: Select all

Macro DesktopScaledXF(x)
  (DesktopScaledX(x * 100) * 0.01)
EndMacro

Debug DesktopScaledX(1)
Debug DesktopScaledXF(1)

Re: DesktopScaledX() should return a double

Posted: Thu Jul 14, 2022 9:33 pm
by Olli
mk-soft wrote: Thu Jul 14, 2022 9:14 pm Not needed ...

Code: Select all

Macro DesktopScaledXF(x)
  (DesktopScaledX(x * 100) * 0.01)
EndMacro

Debug DesktopScaledX(1)
Debug DesktopScaledXF(1)
I forget the word 'not' above. No, the problem is working with only one pixel on dpi aware mode : the OS seems prevent the coder from access to this unique pixel, if

½ =< mod(dpi, 1) < 1

I am in this way (1.75) so the result is very ugly...

Re: DesktopScaledX() should return a double

Posted: Fri Jul 15, 2022 7:34 am
by Little John
I think DesktopScaledX() works as intended.
The purpose of DesktopScaledX() is, that its result can be used as an argument e.g. for creating images. These arguments are integers, so the result of DesktopScaledX() would end up being rounded anyway.
If you are interested in the actual DPI resolution, use DesktopResolutionX().

Code: Select all

Debug DesktopScaledX(1)     ; returns 1 here
Debug DesktopResolutionX()  ; returns 1.25 here

Re: DesktopScaledX() should return a double

Posted: Fri Jul 15, 2022 8:47 am
by Olli
Little John wrote: Fri Jul 15, 2022 7:34 am I think DesktopScaledX() works as intended.
The purpose of DesktopScaledX() is, that its result can be used as an argument e.g. for creating images. These arguments are integers, so the result of DesktopScaledX() would end up being rounded anyway.
If you are interested in the actual DPI resolution, use DesktopResolutionX().

Code: Select all

Debug DesktopScaledX(1)     ; returns 1 here
Debug DesktopResolutionX()  ; returns 1.25 here
I will test DesktopResolutionX().

Re: DesktopScaledX() should return a double

Posted: Fri Jul 15, 2022 10:11 am
by Olli
DesktopResolution X & Y functions offer the right type by returning a floating value.


Thank you for the information Little John.