Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread TCheckbox vertical alignment
Tue, Oct 13 2015 9:42 AMPermanent Link

Matthew Jones

Can someone help me understand this please?

Make a new form, drop on a TLabel, a TCheckbox, and another TLabel. Set
their layout to TopLeft, consume right. Now set the top margin for the
labels to 6. The "Captions" are all aligned nicely yes? (You might want
to reduce the width of the checkbox to get it closer.)

So now run it. The Checkbox label is lower than the other texts. Why?
Should I just fudge it, or is there something I need to know? It makes
my output look poor when I have these mis-aligned items, and I need to
impress on this current project...

Thanks,
Matthew
Tue, Oct 13 2015 11:45 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

If a post isn't about *creating* components, then please post it in the General support forum.

<< So now run it. The Checkbox label is lower than the other texts. Why? >>

This is a problem with the sub-pixel rendering in certain browsers (IE being one of them).  The properties available for element measurement report back whole-pixel values, whereas the *actual* measurements may be more or less than that (floats).

I will see if I can adjust for this in the layout management for design-time/run-time for the heights.  I already do so for the width measurements.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Oct 15 2015 3:24 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

After investigating this further, there's really no bullet-proof way to handle this so that the check box labels align with TLabels without using a container control in which to position the labels as Layout.Position=lpCenter.  It's just the nature of what's going on:  the check box is doing the vertical layout center on an auto-sized label, whereas the labels themselves are vertically-sized using a text height measurement relative to a baseline calculated by the browser.  As such, the label heights could theoretically be different at runtime, and especially when comparing runtime vs. design-time.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Oct 16 2015 4:31 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> After investigating this further, there's really no bullet-proof way
> to handle this so that the check box labels align with TLabels
> without using a container control in which to position the labels as
> Layout.Position=lpCenter.  It's just the nature of what's going on:
> the check box is doing the vertical layout center on an auto-sized
> label, whereas the labels themselves are vertically-sized using a
> text height measurement relative to a baseline calculated by the
> browser.  As such, the label heights could theoretically be different
> at runtime, and especially when comparing runtime vs. design-time.

Okay, I can live with that solution. Thanks.
Image