Jump to content
Sign in to follow this  
Javier Tarí

Need to Remove the PixelsPerInch and TextHeight fake properties

Recommended Posts

Hello,

When you save a form, there are two fake properties saved,  PixelsPerInch and TextHeight. That would be fine, but when making changes on two different systems, one with W7 and other with W10, each saves a different set of values, and that generates false Git differences on the DFMs

 

We never use TForm in any of our projects, but rather an own descendant, so we can change it if that's needed to remove those fake properties

 

Both are not true properties; TCustomForm saves them the DFM using this method:

procedure TCustomForm.DefineProperties(Filer: TFiler);
begin
  inherited DefineProperties(Filer);
  Filer.DefineProperty('PixelsPerInch', nil, WritePixelsPerInch, not IsControl);
  Filer.DefineProperty('TextHeight', ReadTextHeight, WriteTextHeight, not IsControl);
  Filer.DefineProperty('IgnoreFontProperty', ReadIgnoreFontProperty, nil, False);
end;

I can't find any way of avoiding them to be saved on the DFM

 

Can you help me?

 

Thank you

Share this post


Link to post

If you remove PixelsPerInch from the DFM then you'll find that your form layouts break different devs modify forms if their machines use different font scaling (i.e. DPI) settings.

 

In my workplace we handle this by requiring all modifications of forms to be made using a common font scaling setting.  

Share this post


Link to post
1 hour ago, David Heffernan said:

If you remove PixelsPerInch from the DFM then you'll find that your form layouts break different devs modify forms if their machines use different font scaling (i.e. DPI) settings.

In fact, in my case it doesn't ; I've tried removing it and reopening, and the result was the same. I forgot telling that we have "scaled=false" in all forms

 

1 hour ago, David Heffernan said:

In my workplace we handle this by requiring all modifications of forms to be made using a common font scaling setting.  

We have 1920x1080 in all monitors (27" to 32" monitors); before it had different font scaling i.e. W7 = 100% , W10=150%; tried changing the W7 to 150% as well, and the result was no visible changes, and no changed either on the PixelPerInch and TextHeight saved values 

Share this post


Link to post

While Scaled = False is not the suggested standard, is removing these properties still a general solution or does it only work for your use case?

Share this post


Link to post

I don't want to use the automatic scaling; eventually I'll use a customized scaling, so the PixelsPerInch and TextHeight properties are useless to me, and right now they just give fake changes on source control

 

That's why I'd like to get rid of them

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
Sign in to follow this  

×