Is PB's dialog library DPI aware?

Everything else that doesn't fall into one of the other PB categories.
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Is PB's dialog library DPI aware?

Post 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.
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Is PB's dialog library DPI aware?

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

Re: Is PB's dialog library DPI aware?

Post 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?
User avatar
Danilo
Addict
Addict
Posts: 3037
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Is PB's dialog library DPI aware?

Post 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
HanPBF
Enthusiast
Enthusiast
Posts: 563
Joined: Fri Feb 19, 2010 3:42 am

Re: Is PB's dialog library DPI aware?

Post 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
GPI
PureBasic Expert
PureBasic Expert
Posts: 1394
Joined: Fri Apr 25, 2003 6:41 pm

Re: Is PB's dialog library DPI aware?

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

Re: Is PB's dialog library DPI aware?

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

Re: Is PB's dialog library DPI aware?

Post by Little John »

Dear Fred or Freak,

I would be grateful if you could shed light on this. :-)
Last edited by Little John on Thu Sep 24, 2015 1:31 pm, edited 1 time in total.
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Is PB's dialog library DPI aware?

Post by Fred »

We already did some internal test for DPI aware dialog, but it's not really finished, may be for the next version.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Is PB's dialog library DPI aware?

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

Re: Is PB's dialog library DPI aware?

Post 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.
oO0XX0Oo
User
User
Posts: 78
Joined: Thu Aug 10, 2017 7:35 am

Re: Is PB's dialog library DPI aware?

Post 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?
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Is PB's dialog library DPI aware?

Post by Kukulkan »

I'm also interested!
Post Reply