Page 1 of 1
Is PB's dialog library DPI aware?
Posted: Sun Sep 13, 2015 8:06 am
by Little John
Hi,
in PB's
Reference Manual it reads:
The dialog library allow to easily create complex user interface (GUI) based on an XML definition. It features automatic gadget layout, which is very useful when creating interface which needs to work on different operating systems or working with different font size.
Does this mean that a GUI created with PB's dialog library is automatically DPI aware? That would be very cool.
Re: Is PB's dialog library DPI aware?
Posted: Sun Sep 13, 2015 10:31 am
by Danilo
DPI-awareness is one of the most important things today, in my opinion.
More and more people are switching to Retina/4k/5k displays, and in the
transistion phase the other people still have cheaper, low-res, full HD displays.
It's not only about the dialog lib, it's also functions like GetDpiX/Y for all
output devices (screen, printer, ...). AFAIK such functions are available
on all supported platforms - because it is a basic requirement for developers.
On printers such functions are required to be able to produce the same ouput
on printers with 300/600/2400 DPI. It's the same with displays - 96 vs. 200+ DPI/PPI.
Re: Is PB's dialog library DPI aware?
Posted: Sun Sep 13, 2015 10:40 am
by Little John
Hi Danilo, thanks for your reply.
Danilo wrote:DPI-awareness is one of the most important things today, in my opinion.
More and more people are switching to Retina/4k/5k displays, and in the
transistion phase the other people still have cheaper, low-res, full HD displays.
I agree.
Danilo wrote:it's also functions like GetDpiX/Y for all
output devices (screen, printer, ...). AFAIK such functions are available
on all supported platforms - because it is a basic requirement for developers.
I know.

I'm currently using those GetDpiX/Y functions in my programs (on Windows).
However, it would be more elegant/easier for me if the dialog library would take care of this.
It would be a generic solution, without the need for different API calls on different platforms.
And of course we need to know:
When a program uses PB's dialog library, does it have to use additionally those GetDpiX/Y API functions, or can it do without them?
Re: Is PB's dialog library DPI aware?
Posted: Sun Sep 13, 2015 12:29 pm
by Danilo
Little John wrote:And of course we need to know:
When a program uses PB's dialog library, does it have to use additionally those GetDpiX/Y API functions, or can it do without them?
Of course everything should be documented
Re: Is PB's dialog library DPI aware?
Posted: Sun Sep 13, 2015 2:59 pm
by HanPBF
Won't it work to put "width='100em'" or "height='120mm'" into the source and replace it by regexp
with the corrected values?
I don't see a good way of standardization here...
And it's only about DPI not layout correct...?
Code: Select all
procedure getDPIXScreen()
protected hdc,
xdpi
hdc = GetDC_(GetDesktopWindow_())
if hdc
xdpi = GetDeviceCaps_(hdc, #LOGPIXELSX)
ReleaseDC_(GetDesktopWindow_(), hdc)
endIf
procedureReturn xdpi
endProcedure ; getDPIXScreen
procedure getDPIYScreen()
protected hdc,
ydpi
hdc = GetDC_(GetDesktopWindow_())
if hdc
ydpi = GetDeviceCaps_(hdc, #LOGPIXELSY)
ReleaseDC_(GetDesktopWindow_(), hdc)
endIf
procedureReturn ydpi
endProcedure ; getDPIYScreen
Re: Is PB's dialog library DPI aware?
Posted: Sun Sep 13, 2015 8:33 pm
by GPI
I don't think, that scaling to DPI is always usefull. For example, when I connect my pc with my 50Inch TV in 1080p - everything would be unreadable small.
Also important, how far away are you from the display? My TV is much bigger, but because i sit more far away, everything is a little bit smaller. That is a problem of many PS4/3,XBOX360/ONE-Games that the text is very small. I think this is because the developer test everything on a monitor and not on a TV.
And for example older people prefer often a zoomed view.
There should be OS-Api-Routines to handle the sclaing...
Re: Is PB's dialog library DPI aware?
Posted: Sun Sep 13, 2015 8:51 pm
by Little John
GPI wrote:There should be OS-Api-Routines to handle the sclaing...
Yes, as written above, there
are OS API routines for handling the scaling ...
My question in this thread is, whether a GUI created with PB's dialog library is automatically DPI aware,
so that it's not necessary for me to call the respective API routines in the program myself.
Re: Is PB's dialog library DPI aware?
Posted: Thu Sep 24, 2015 7:19 am
by Little John
Dear Fred or Freak,
I would be grateful if you could shed light on this.

Re: Is PB's dialog library DPI aware?
Posted: Thu Sep 24, 2015 7:25 am
by Fred
We already did some internal test for DPI aware dialog, but it's not really finished, may be for the next version.
Re: Is PB's dialog library DPI aware?
Posted: Thu Sep 24, 2015 7:29 am
by Kukulkan
Hi All,
I also reported and asked DPI related questions and wishes in the past (starting Dec. 2013). They are all not really done:
http://www.purebasic.fr/english/viewtop ... =7&t=57737
http://www.purebasic.fr/english/viewtop ... =3&t=61139
http://www.purebasic.fr/english/viewtop ... 19&t=62517
http://www.purebasic.fr/english/viewtop ... =3&t=60506 (point 5)
Would be really great if at least the XML Dialogue would respect OS settings for DPI on used Desktop/Monitor.
Kukulkan
Re: Is PB's dialog library DPI aware?
Posted: Thu Sep 24, 2015 1:30 pm
by Little John
Fred wrote:We already did some internal test for DPI aware dialog, but it's not really finished, may be for the next version.
That's cool, thank you for the information!
I'm looking forward to have this feature in a future PB version.

Thanks.
Re: Is PB's dialog library DPI aware?
Posted: Mon Dec 04, 2017 11:36 pm
by oO0XX0Oo
I've looked through the changelogs since 2015 up to v5.61 but
I don't see any comment that dialog should now be totally DPI aware.
So, what's the current state?
Re: Is PB's dialog library DPI aware?
Posted: Tue Dec 05, 2017 8:10 am
by Kukulkan
I'm also interested!