Ian Branch 127 Posted October 8, 2021 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
Ian Branch 127 Posted October 9, 2021 Just to further clarify, it changes visibly on the screen when I click Build or Compile. :-( Share this post Link to post
Anders Melander 1784 Posted October 9, 2021 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
Kryvich 165 Posted October 9, 2021 Try temporarily turn off Display Scaling in Windows. Share this post Link to post
Ian Branch 127 Posted October 9, 2021 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
Anders Melander 1784 Posted October 9, 2021 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
Anders Melander 1784 Posted October 9, 2021 Well, save the file and compare the DFM before/after. What changed? Share this post Link to post
Ian Branch 127 Posted October 9, 2021 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
Anders Melander 1784 Posted October 9, 2021 So revert to a version that does exhibit the problem and try again. You are using version control, right? Share this post Link to post
Ian Branch 127 Posted October 9, 2021 Yes I am. I shall see what happens. Share this post Link to post
Ian Branch 127 Posted October 12, 2021 Ah Ha! It is the ClientWidth and the ClientHeight that are changing value.. 😞 Share this post Link to post
Anders Melander 1784 Posted October 12, 2021 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
Ian Branch 127 Posted October 12, 2021 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
Fabio Vitale 0 Posted October 7, 2023 Do you have found a solution for this issue? I am having the very same issue. Regards fabio Share this post Link to post