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

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Olli
Addict
Addict
Posts: 1201
Joined: Wed May 27, 2020 12:26 pm

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

Post 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 ?
Last edited by Olli on Fri Jul 15, 2022 10:12 am, edited 1 time in total.
User avatar
NicTheQuick
Addict
Addict
Posts: 1504
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: DesktopScaledX() should return a double

Post by NicTheQuick »

+1
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: DesktopScaledX() should return a double

Post by Caronte3D »

+1
Olli
Addict
Addict
Posts: 1201
Joined: Wed May 27, 2020 12:26 pm

Re: DesktopScaledX() should return a double

Post by Olli »

Uw... Indeed, it is perhaps not to Fred I should write this to, but Microsoft... :shock:
Last edited by Olli on Thu Jul 14, 2022 9:34 pm, edited 2 times in total.
User avatar
mk-soft
Always Here
Always Here
Posts: 6209
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: DesktopScaledX() should return a double

Post by mk-soft »

Not needed ...

Code: Select all

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

Debug DesktopScaledX(1)
Debug DesktopScaledXF(1)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Olli
Addict
Addict
Posts: 1201
Joined: Wed May 27, 2020 12:26 pm

Re: DesktopScaledX() should return a double

Post 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...
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: DesktopScaledX() should return a double

Post 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
Olli
Addict
Addict
Posts: 1201
Joined: Wed May 27, 2020 12:26 pm

Re: DesktopScaledX() should return a double

Post 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().
Olli
Addict
Addict
Posts: 1201
Joined: Wed May 27, 2020 12:26 pm

Re: DesktopScaledX() should return a double

Post by Olli »

DesktopResolution X & Y functions offer the right type by returning a floating value.


Thank you for the information Little John.
Post Reply