Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Planning an upgrade to High DPI awareness in XE8 - I have 10 questions


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 9 - Last Post: Jan 23, 2016 2:21 PM Last Post By: Quentin Correll
Carl Olsen

Posts: 124
Registered: 3/29/00
Planning an upgrade to High DPI awareness in XE8 - I have 10 questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 19, 2016 3:59 PM
Anyone here experienced with high DPI awareness? I have just upgraded all my projects from Delphi 2006 to XE8. These applications run on Vista, 7, and 10. I need to plan how to best convert to be high DPI aware, and I have some questions:

1 - What pitfalls do I need to plan for regarding converting over to high DPI aware?

2 - What reliable resources are out there I can learn from? (I found one great one that I link to below)

3 - Will high DPI aware conflict with VCL Styles?

4 - Is there a way for a component to "know" if the application it is running on is running as High DPI aware?

5 - How does one handle things like a "glyph" on a button that suddenly becomes tiny relative to the button?

6 - How do I make custom mouse cursors that don't get all chunky when Windows scales them?

7 - What format do I use for my form's icon property so that it is not chunky or weird?

8 - Is the fact that I'm upgrading from 2006 to XE8 going to do anything weird on me relating to high DPI, like have some leftover auto-generated code pollution or similar?

9 - What do you do for testing? Do you set your development PC to use high DPI scaling and then run from Delphi, or do you use a second PC, VM, or similar? (I see the test matrix for this to likely be huge)

10 - Any other tips to be successful?

So far, I have successfully created a "Hello World" application that seems to work okay in a High DPI environment, but since my real applications are giant, I want to plan better about how to go about it, so that I don't end up with a mess such as doing the "almost right" thing in 800 places. Also, when I Google stuff, I find a lot of mixed information, some of it conflicting and apparent superstition, so nailing down what is "true" would really help in planning.

By the way, the best guide I have found for this so far is the 38 page PDF here: https://community.embarcadero.com/blogs/entry/how-to-guide-upgrading-your-delphi-vcl-applications-to-support-4k-displays. It has been a great introduction, and I strongly recommend it as a starting point for anyone else planning for this.

Thanks!

Carl.
Brandon Staggs

Posts: 683
Registered: 3/3/01
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10 questions
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 21, 2016 7:47 AM   in response to: Carl Olsen in response to: Carl Olsen
"Carl Olsen" wrote on Tue, 19 Jan 2016 15:59:10 -0800:

Anyone here experienced with high DPI awareness? I have just
upgraded all my projects from Delphi 2006 to XE8. These
applications run on Vista, 7, and 10. I need to plan how to best
convert to be high DPI aware, and I have some questions:

You should go to Seattle, not just 8.

1 - What pitfalls do I need to plan for regarding converting over
to high DPI aware?

If you go to true high-DPI awareness, the biggest "pitfall" will be
properly supporting multi-DPI monitor setups. It will take a lot of
testing to ensure proper behavior.

3 - Will high DPI aware conflict with VCL Styles?

VCL styles do not scale, so "sort of." I was hoping to use VCL styles
after my high-dpi updates were complete but abandoned it because while
Embarcadero saw fit to add high-DPI as a default manifest setting they
didn't bother to make modifications to VCL styles to actually support
it.

The biggest problem here are custom non-client areas, such as the
application window buttons, which are microscopic on the Surface Book,
for example.

4 - Is there a way for a component to "know" if the application it
is running on is running as High DPI aware?

Sure, you could use the low level Win32 API to see if the process is
high-dpi aware. But if you are designing components you should simply
assume it will be used in a high-dpi environment and not make any
code-level assumptions about DPI, not the least of which is the
invalid assumption that DPI will not change during execution.

5 - How does one handle things like a "glyph" on a button that
suddenly becomes tiny relative to the button?

That's up to you. I have a PNG image list class that will select an
appropriate PNG based on the resolution. There are other approaches.
A better approach is to get all of your assets in vector form (SVG)
and use something to render those.

7 - What format do I use for my form's icon property so that it is
not chunky or weird?

This hasn't changed. Your icon should have multiple resolutions all
the way up to 256x256.

8 - Is the fact that I'm upgrading from 2006 to XE8 going to do
anything weird on me relating to high DPI, like have some leftover
auto-generated code pollution or similar?

High-DPI is only one of your potential pitfalls here. You will need
to test a lot.

9 - What do you do for testing? Do you set your development PC to
use high DPI scaling

NEVER NEVER NEVER NEVER DO THAT. Delphi IDE CAN NOT handle high-DPI
(despite their marketing material) and will ruin your DFM files in
such a senario.

Add a monitor to your system and set it to its own higher DPI. Also
test on something like a Surface Book that has a 200% scaling level by
default.

--
Brandon Staggs
StudyLamp Software LLC
http://www.studylamp.com
Carl Olsen

Posts: 124
Registered: 3/29/00
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10 questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 21, 2016 12:05 PM   in response to: Brandon Staggs in response to: Brandon Staggs
Hi Brandon,

Thanks for taking the time to reply! I have a couple of follow up questions on your reply below:

You should go to Seattle, not just 8.

Is there a feature in particular that will help in regards to either theming or High DPI awareness that makes you say this? The reason I ask is that upgrading Delphi can be a quite tedious process for me and several developers that I need a very compelling reason to justify that for.

3 - Will high DPI aware conflict with VCL Styles?

VCL styles do not scale, so "sort of." I was hoping to use VCL styles
after my high-dpi updates were complete but abandoned it because while
Embarcadero saw fit to add high-DPI as a default manifest setting they
didn't bother to make modifications to VCL styles to actually support
it.

That is a bummer! I suppose if I made variations of my own "Styles", and then said something like "IF High DPI, then LoadStyle1 else LoadStyle2"?

9 - What do you do for testing? Do you set your development PC to
use high DPI scaling

NEVER NEVER NEVER NEVER DO THAT. Delphi IDE CAN NOT handle high-DPI
(despite their marketing material) and will ruin your DFM files in
such a senario.

Thanks for the heads up on that! I had an issue with going to "large fonts" way back in Delphi 2 or so, and have been spooked ever since. It is good to know not to give it another try!

Carl.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 21, 2016 12:33 PM   in response to: Carl Olsen in response to: Carl Olsen
Carl wrote:

Is there a feature in particular that will help in regards to either
theming or High DPI awareness that makes you say this?

Yes. Support for High DPI has been added to the IDE and VCL in Seattle:

New in 10 Seattle! High-DPI Awareness and 4K monitors support, plus Windows
8.1/10 multi-monitor support for VCL applications

The reason I ask is that upgrading Delphi can be a quite tedious process
for me and several developers that I need a very compelling reason to
justify that for.

Well, if you are going to upgrade anyway, why not upgrade to the latest?
XE8 is not the latest.

--
Remy Lebeau (TeamB)
Carl Olsen

Posts: 124
Registered: 3/29/00
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 21, 2016 12:39 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Yes. Support for High DPI has been added to the IDE and VCL in Seattle:

Excellent news! I may very well make this upgrade for this single feature change.

Well, if you are going to upgrade anyway, why not upgrade to the latest?
XE8 is not the latest.

...except I'm already upgraded to XE8 (which took many months to do from 2006, though I am hopeful it will be easier if I choose to now go to Seattle since in theory much of the hard work is behind me.)
Quentin Correll


Posts: 2,412
Registered: 12/1/99
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10 questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 21, 2016 12:39 PM   in response to: Brandon Staggs in response to: Brandon Staggs
Brandon,

| Delphi IDE CAN NOT handle high-DPI

So what constitutes "high-DPI"?

--

Q -- XanaNews 1.19.1.372 - 2016-01-21 12:39:11
Brandon Staggs

Posts: 683
Registered: 3/3/01
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10 questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 22, 2016 8:40 AM   in response to: Quentin Correll in response to: Quentin Correll
"Quentin Correll" wrote on Thu, 21 Jan 2016 12:39:55 -0800:

So what constitutes "high-DPI"?

https://msdn.microsoft.com/en-us/library/windows/desktop/dd464646(v=vs.85).aspx

--
Brandon Staggs
StudyLamp Software LLC
http://www.studylamp.com
Quentin Correll


Posts: 2,412
Registered: 12/1/99
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10 questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 22, 2016 11:00 AM   in response to: Brandon Staggs in response to: Brandon Staggs
Brandon,

| | So what constitutes "high-DPI"?
|

https://msdn.microsoft.com/en-us/library/windows/desktop/dd464646(v=vs.85).aspx

"Any custom DPI setting with more than 96 DPI (the default setting)."

Thanks! (Serious. I did not know that, even though I've obviously
been using "high-DPI" for many years..)

--

Q -- XanaNews 1.19.1.372 - 2016-01-22 10:58:27
Brandon Staggs

Posts: 683
Registered: 3/3/01
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10 questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2016 1:16 PM   in response to: Quentin Correll in response to: Quentin Correll
"Quentin Correll" wrote on Fri, 22 Jan 2016 11:00:12 -0800:

Brandon,

|| So what constitutes "high-DPI"?
|

https://msdn.microsoft.com/en-us/library/windows/desktop/dd464646(v=vs.85).aspx

"Any custom DPI setting with more than 96 DPI (the default setting)."

Thanks! (Serious. I did not know that, even though I've obviously
been using "high-DPI" for many years..)

However, what is meant by "high-dpi" with regard to developing Win32
applications is a lot more than a DPI value. I'd say it also means:

- properly scaling to any DPI
- properly re-scaling in response to dpi change messages
- properly scaling individual windows for environments with multiple
monitors with different dpis.

--
Brandon Staggs
StudyLamp Software LLC
http://www.studylamp.com
Quentin Correll


Posts: 2,412
Registered: 12/1/99
Re: Planning an upgrade to High DPI awareness in XE8 - I have 10 questions  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 23, 2016 2:21 PM   in response to: Brandon Staggs in response to: Brandon Staggs
Brandon,

| However, what is meant by "high-dpi" with regard to developing Win32
| applications is a lot more than a DPI value. I'd say it also means:

| - properly scaling to any DPI
| - properly re-scaling in response to dpi change messages

| - properly scaling individual windows for environments with multiple
| monitors with different dpis.


Makes sense.

--

Q -- XanaNews 1.19.1.372 - 2016-01-23 14:21:51
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02