Recent

Author Topic: Class helper for TCONTROL  (Read 681 times)

jamie

  • Hero Member
  • *****
  • Posts: 6090
Class helper for TCONTROL
« 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 ?

The only true wisdom is knowing you know nothing

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Class helper for TCONTROL
« Reply #1 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 :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018