Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: VCL form content resize issue


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


Permlink Replies: 5 - Last Post: Oct 12, 2017 3:39 PM Last Post By: Ede Csanádi
Ede Csanádi

Posts: 40
Registered: 10/9/06
VCL form content resize issue  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 6, 2017 9:22 PM
Hi!

The issue is not happening here but on other systems.
The form is quite simple, on user's system the content is like the window is sliced at a smaller width and height value.

[How it should appear|https://www.3delite.hu/Misc/MP4%20Video%20&%20Audio%20Tag%20Editor%20-%20FullHD%20150%25%20DPI%20-%202.png]
[How it appears wrong|https://www.3delite.hu/Misc/movie%20db.PNG]

Although there's a clue, according to the user, another of my apps. which has exactly this same window, works fine. Comparing the 2 .dfm files there are "ExplicitWidth" and some more "Explicit*" properties in the .dfm file that works. I have no idea how they got there. Maybe this fixes the issue... If so how to get Delphi write these properties?

Any help would be appreciated!

Thank you!

Best regards
3delite
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: VCL form content resize issue  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 7, 2017 12:42 AM   in response to: Ede Csanádi in response to: Ede Csanádi
Ede Csanádi wrote:

Hi!

The issue is not happening here but on other systems.
The form is quite simple, on user's system the content is like the
window is sliced at a smaller width and height value.

[How it should
appear|https://www.3delite.hu/Misc/MP4%20Video%20&%20Audio%20Tag%20Edi
tor%20-%20FullHD%20150%25%20DPI%20-%202.png] [How it appears
wrong|https://www.3delite.hu/Misc/movie%20db.PNG]

Although there's a clue, according to the user, another of my apps.
which has exactly this same window, works fine. Comparing the 2 .dfm
files there are "ExplicitWidth" and some more "Explicit*" properties
in the .dfm file that works. I have no idea how they got there. Maybe
this fixes the issue... If so how to get Delphi write these
properties?

Any help would be appreciated!

Check if both forms have the same value for the Scaled property. Scaled
has a effect on the form display if design-time and run-time systems
work with different display resolutions (screen DPI).

These explicit properties are only used by the designer, not at
run-time. They record the size and position of a control it had when
last placed, sized, or moved while align is set to none. The designer
uses this to revert the control to the stored values when you set Align
from client or border alignment back to none.


--
Peter Below
TeamB

Ede Csanádi

Posts: 40
Registered: 10/9/06
Re: VCL form content resize issue  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 7, 2017 5:48 PM   in response to: Peter Below in response to: Peter Below
Thank you for your reply!

Scaled is False on every form, I have been working on DPI scaling support recently, and every form is scaled manually when needed. On the problematic system scaling is not active, but on the second picture is. The funny thing is that the problem occurs both when scaling the form and when not also.
My try was to set WindowsState to wsMaximized, hoping that it will resize the form properly, both didn't help. The user replied that the form still doesn't show properly.
The only difference in the 2 .dfm files are the Explicit values, everything else is perfectly the same.

The reason i don't understand is that here it's working fine, Windows 7, Windows 10, scaled, not scaled, everything is as it should be.
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: VCL form content resize issue  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 8, 2017 12:22 AM   in response to: Ede Csanádi in response to: Ede Csanádi
Ede Csanádi wrote:

Thank you for your reply!

Scaled is False on every form, I have been working on DPI scaling
support recently, and every form is scaled manually when needed. On
the problematic system scaling is not active, but on the second
picture is. The funny thing is that the problem occurs both when
scaling the form and when not also. My try was to set WindowsState
to wsMaximized, hoping that it will resize the form properly, both
didn't help. The user replied that the form still doesn't show
properly. The only difference in the 2 .dfm files are the Explicit
values, everything else is perfectly the same.

The check the values of the Align and anchor properties. And if you are
scaling a form in code, do you do that based on the form width and
height, or on the form's clientheigth and clientwidth? You have to use
the latter, since a form's non-client area elements (like the caption
bar, and border) may have different sizes on different systems.

Is your application marked as high-DPI aware in its manifest? That can
also be important since Windows will lie to an application not so
marked when it askes for the display resolution...

--
Peter Below
TeamB
Ede Csanádi

Posts: 40
Registered: 10/9/06
Re: VCL form content resize issue  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 8, 2017 3:28 AM   in response to: Peter Below in response to: Peter Below
Thank you for the hints! Delphi's ScaleBy() is far from perfect, a lot of things need to be adjusted manually and I usually do the adjustment in the parent TPanel's (or TGroupBox) OnResize event of the specific control - most time use TPanel.Width. But as I wrote the issue demonstrated with the first snapshot, scaling is not active it's 100%, that means Delphi's and my scaling code is not run at all.
Ede Csanádi

Posts: 40
Registered: 10/9/06
Re: VCL form content resize issue  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 12, 2017 3:39 PM   in response to: Ede Csanádi in response to: Ede Csanádi
The workaround was to add a TPanel to the form, set it to Align = alClient and copy/paste all the controls inside.
The user replied that it works and the Windows Store team accepted the submission.

Don't know what the reason was though.

Thank you!
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02