Board index » cppbuilder » [bds2006] Multi-line label control?

[bds2006] Multi-line label control?


2007-11-22 12:31:10 AM
cppbuilder23
What control is available to present multi-line descriptive text on a form,
similar to TLabel in appearance, but allowing ease of entering the text at
design time similar to TMemo?
Thanks.
 
 

Re:[bds2006] Multi-line label control?

"dhoke" < XXXX@XXXXX.COM >wrote in message
Quote
What control is available to present multi-line descriptive
text on a form, similar to TLabel in appearance
TLabel already supports multiple lines. Set the AutoSize property to False
and the WordWrap property to True. Then you can put line breaks in the
Caption.
Quote
but allowing ease of entering the text at design time
similar to TMemo?
There is no native editor for that. You will have to find a third-party one
(such as in RxLib), or write your own and register it with TLabel.
Alternatively, you can enter the Caption normally, then edit the DFM in text
mode to insert line breaks directly.
Gambit
 

Re:[bds2006] Multi-line label control?

Hi dhoke
dhoke says:
Quote
What control is available to present multi-line descriptive text on a form,
similar to TLabel in appearance, but allowing ease of entering the text at
design time similar to TMemo?
TMemo
BorderStyle = bsNone;
Color = clBtnFace;
ScrolBars = ssNone;
ReadOnly = true;
TabStop = false;
and if the cursor kill Your eye
void __fastcall TForm1::Memo1Enter(TObject *Sender)
{
SomeControl->SetFocus();
}
//-----------------------------------------------
Kind regards
Asger
 

{smallsort}

Re:[bds2006] Multi-line label control?

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

TLabel already supports multiple lines. Set the AutoSize property to
False and the WordWrap property to True. Then you can put line breaks in
the Caption.

How do you put in the line breaks? It doesn't seem to interpret \n in text
entered directly (attempted ala MessageBox strings), and if I enter the text
in notepad and copy everything into the Caption properties field, it
truncates it at the first end-of-line...
Quote

Alternatively, you can enter the Caption normally, then edit the DFM in
text mode to insert line breaks directly.
Can you provide an example of what the dfm text for one such label might
look like? IDE doesn't seem to like literals continued across line breaks,
and I could make guesses as to what else might work, but if you can provide
an example, that seems a lot easier. (Sometimes I don't guess so well.)
Thanks.
Quote


Gambit

 

Re:[bds2006] Multi-line label control?

Hi dhoke
dhoke says:
Quote

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...
>
>TLabel already supports multiple lines. Set the AutoSize property to
>False and the WordWrap property to True. Then you can put line breaks in
>the Caption.
>
How do you put in the line breaks? It doesn't seem to interpret \n in text
entered directly (attempted ala MessageBox strings), and if I enter the text
in notepad and copy everything into the Caption properties field, it
truncates it at the first end-of-line...
It have to be "\r\n" other wise You just get a |
Kind regards
Asger
 

Re:[bds2006] Multi-line label control?

"dhoke" < XXXX@XXXXX.COM >wrote in message
Quote
How do you put in the line breaks?
Label1->Caption = "This is line 1\r\nThis is line 2";
Quote
Can you provide an example of what the dfm text for one
such label might look like?
object Label1: TLabel
Left = 136
Top = 56
Width = 193
Height = 89
AutoSize = False
Caption = 'This is line 1'#13#10'This is line 2'
WordWrap = True
end
Gambit
 

Re:[bds2006] Multi-line label control?

Remy and Asger,
Thanks for the help.
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"dhoke" < XXXX@XXXXX.COM >wrote in message
news:474492a7$ XXXX@XXXXX.COM ...

>How do you put in the line breaks?

Label1->Caption = "This is line 1\r\nThis is line 2";

>Can you provide an example of what the dfm text for one
>such label might look like?

object Label1: TLabel
Left = 136
Top = 56
Width = 193
Height = 89
AutoSize = False
Caption = 'This is line 1'#13#10'This is line 2'
WordWrap = True
end


Gambit

 

Re:[bds2006] Multi-line label control?

Remy Lebeau (TeamB) wrote:
Quote
>"dhoke" wrote in message
>... entering the text at design time similar to TMemo?
There is no native editor for that. You will have to find a
third-party one (such as in RxLib), or write your own and register it
with TLabel.
JVCL has this design editor. Very handy ;-)
--
Alex