Lazarus

Programming => General => Topic started by: jamie on July 17, 2019, 01:33:30 am

Title: Class helper for TCONTROL
Post by: jamie on July 17, 2019, 01:33:30 am
So I am experimenting with a Class Helper for the TControl! The reason you say ? Well I would like the ease of having a metric set and get of the BoundsRect, Width, Height, Left, Top etc..

 So when done, this is what I can do.

 MyControl.WidthInches := 1.450;
 MyControl.HeightInches:= 1.890;

 the BoundsRect has a TRectInches type.

This does not upset the current method in fact you can go between the two, If I set the Size via Inches I can reference the Width and Height properties which are now the scaled pixels or the other way round.

 I have been using the Screen.PixelPerInch property for the time being in the calculations..

 This Helper class of course can be expanded to do MM instead of inches.

 So the idea is if I wish to use a metric to size things I can or use a pixel...

 What do you think about this ?

Title: Re: Class helper for TCONTROL
Post by: lucamar on July 17, 2019, 03:11:26 am
You mean doing things like: Form.SetWidthInInches(6.0)?

Might be nice. I would do it (did it, for graphics) in a function instead of a helper, more flexible, but sounds nice none the less.

Although it doesn't sound very useful, maybe, except for very specific necessities. But it's good if one needs it and it's there :)