Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread TLabel content height
Mon, Feb 11 2013 10:55 AMPermanent Link

Matthew Jones

Is there a way I can determine the height of the content of a TLabel? I am
obtaining the content from a source I don't control, which may have anything from
one word to several lines of text, possibly with <br> breaks. I need to move other
controls to below the text so it looks nice - I don't want lots of white space for
small content. There appears to be no way to have it auto-size downward or to tell
me how big the content is, as opposed to the height of the label which may be
independent.

Is there some browser function I can call to find out how big the content actually
is?

/Matthew Jones/
Mon, Feb 11 2013 11:46 AMPermanent Link

Matthew Jones

FWIW, this applies to TRadioButtons too. I need to know the height that the radio
button should be with long text.

/Matthew Jones/
Tue, Feb 12 2013 3:20 AMPermanent Link

Mark Brooks

Slikware

Avatar

>>Is there a way I can determine the height of the content of a TLabel? I am
>>obtaining the content from a sourceThere appears to be no way to have it auto-size downward or to tell
>>me how big the content is, as opposed to the height of the label which may be
>>independent.

This works fine for me. I'm building a GUI at run-time and need to position sequentially "down the page" as you suggest. I create my TLabels with AutoSize = True and WordWrap = True. Setting the Caption or Font.Size changes the Height property allowing me to position accordingly.
Tue, Feb 12 2013 4:46 AMPermanent Link

Matthew Jones

TVM, I will experiment further. So you set it to autosize and wordwrap, then set
the width? Autosize at design time causes the width to shrink.

If you have a code snippet, I'd appreciate it, but I will experiment here too. So
far I'm loving the whole EWB thing.

/Matthew Jones/
Tue, Feb 12 2013 6:47 AMPermanent Link

Matthew Jones

Okay, you are quite right. Although Autosize sets the size to the label text at
design time, if you then resize it and set the text, it does update the height at
run time. I've added code to set the width properly in case the IDE decides to
mangle it, but this works well. Now to work on the radio buttons...

/Matthew Jones/
Tue, Feb 12 2013 8:08 AMPermanent Link

Matthew Jones

> Now to work on the radio buttons...

Okay, can't do it with this - no auto-size or word-wrap property to set. This would
be a nice enhancement for future updates...

/Matthew Jones/
Image