Jump to content
Edwin Yip

When `Scaled` is set, form inheritance will cause duplicated scaling? Any one can confirm?

Recommended Posts

Hi all,

 

I've just encountered an issue that's quite strange and it took me hours to figure out but still couldn't confirm where dose it come from.

 

The situation I found is like this:

Let's say we have a VCL program with DPI-aware enabled (with xml manifest correctly set, all forms have `Scaled` set to true and working), and the form inheritance is like this:

TFormC inherits from TFormB which in turn inherits from TFormA, which have some buttons on some panels.

 

I found that, when running on a computer with different system DPI, TFormA will be auto scaled for 1 time and it's correct.

But TFormB will be wrongly scaled and shifted twice, while TFormC will be scaled and shifted for 3 times.

 

All other forms, even with form inheritance, but since there is no controls on the parent forms, the auto-scaling works.

 

I'm not sure if it's related to my Delphi version and I use XE4, I wonder anyone can confirm if the issue comes from form inheritance? 

Edited by Edwin Yip

Share this post


Link to post
Guest

I remember this from XE2. I had a small program that removed "ExplicitHeight/Width" IIRC from the dfm's before build. But it was a long time ago, sorry. I do not have the details. HTH.

Share this post


Link to post
2 hours ago, David Heffernan said:

This has always been fine here. How can this be reproduced? 

Thanks for the info. I'm not sure (yet). I'll be back with more details...

Share this post


Link to post
19 hours ago, Edwin Yip said:

Let's say we have a VCL program with DPI-aware enabled (with xml manifest correctly set, all forms have `Scaled` set to true and working), and the form inheritance is like this:

TFormC inherits from TFormB which in turn inherits from TFormA, which have some buttons on some panels.

[...]

TFormA will be auto scaled for 1 time and it's correct. But TFormB will be wrongly scaled and shifted twice, while TFormC will be scaled and shifted for 3 times.

Any special alignments of panels and buttons (Bottom, Right)?

Can you provide a sample project?

Share this post


Link to post
1 hour ago, Achim Kalwa said:

Any special alignments of panels and buttons (Bottom, Right)?

Can you provide a sample project?

Yes, the bottom-most panel is alClient, on the second level are a list of row-panels with alTop, and on the third level one is alLeft and another is alClient.

 

I'll try to get a reproducible sample later after the more important tasks are done... Thanks for your concern.

Share this post


Link to post

I (not just me) have the experience that if there are several components differently aligned, then there are problems with that.
Try to align the components when creating the form. It is best to create them dynamically

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×