Jump to content
Ian Branch

D11 - Form changes size when I compile/build. :-(

Recommended Posts

Hi Team,

Win 11, D11, 4k monitor.  Delphi is started as /highdpi:unaware.

I know this is something I am going to have to deal with more and more. :-(

I have a form that during design time is 1462 wide, ClientWidth of 1449.

When I Compile or Build it the form collapses on screen to ClientWidth 1132. :-(

BorderStyle is bsDialog.

Scaled is OFF.

The Manifest has DPI Awareness set to None.

The Apps are to run on old Win 7 PCs.

I can stop it collapsing by setting a MinWidth Constraint for the form but I shouldn't need to.  Or do I?

What am I missing in my form setup please?  Or it is what it is?

 

Regards & TIA,

Ian

Share this post


Link to post

Just to further clarify, it changes visibly on the screen when I click Build or Compile. :-(

Share this post


Link to post
2 hours ago, Ian Branch said:

it changes visibly on the screen when I click Build or Compile. 😞

My guess is that the values are modified on save and that you have Save on compile checked.

There could be something wrong with the writers defined in TCustomForm.DefineProperties.

Share this post


Link to post

Try temporarily turn off Display Scaling in Windows.

Share this post


Link to post

Anders, No that setting is off.

Kryvich, If it was a Windows thing wouldn't the issue appear on all form?

 

All - To stop it I set the forms constraints.  That worked.   I have just now removed the Constraints and the form doesn't collapse on Compile/Build any more.  Wierd.. 

 

Share this post


Link to post

Well now that I think about it the setting doesn't have to be enabled.

 

When you have a form opened in the IDE then the IDE will use the opened copy of the form (and the source) when compiling instead of using the original on disk. So let's say that loading the form somehow alters the state of the TCustomForm object. When compiling the problect this form is "saved" (i.e. the DFM is streamed in binary format) to the internal buffer and then linked into the executable as a DFM resource.

 

If you open the form in the IDE and (view it in form designer ) and then immediately close the unit, are you prompted to save the unti?

Share this post


Link to post

Hi Anders - That's a good trick to know/use.

The Form isn't actually changing size now when I click build or compile.

But, When I open/close it in the designer I am still invited to save it.

I checked the before and after .dfm files and there is no difference.

Share this post


Link to post

Hmm.  Normally I would say that maybe it could be explained by a change in the window frame width due to Win11, but given the size of the change (-317 pixels) it must be something else.

Unfortunately I don't have a Win11 system with D11 on it yet so I can't try to reproduce.

 

If you edit the DFM file in notepad and remove everything but the form properties, does the problem (i.e. open in the IDE, save file, size changes on save) still occur? If yes, can you attach the edited DFM here?

Share this post


Link to post

Hi Anders,

Thank you for your reply/offer.

I am in the middle of a project att and again I have mitigated the issue by setting the form contraints.

When I clear this project I will revert the build and have a play as you suggest and advise.

 

Regards & Tks Again,

Ian

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

×