Board index » cppbuilder » TLabel::Width

TLabel::Width


2005-07-13 07:28:23 PM
cppbuilder0
In the code
TLabel *Label = new TLabel(NULL);
Label->Width = 0;
Label->Caption = "hello!"
int a = Label->Width
i can see that a is 0.
But if i add, after new,
Label->Font->Style = TFontStyles() << fsBold:
it happens a>0 automatically.
Well, i don't know if it's really related to the FontStyle or not.
In my case i need that hte Width changes by itself.
Some help? Thanks.
 
 

Re:TLabel::Width

"mauro russo" < XXXX@XXXXX.COM >wrote:
Quote

[...] In my case i need that hte Width changes by itself.
Have you looked at the AutoSize property yet? Also, try
setting the Parent before you look at it's Width.
~ JD
 

Re:TLabel::Width

Quote
In the code

TLabel *Label = new TLabel(NULL);

Label->Width = 0;
Label->Caption = "hello!"
int a = Label->Width

i can see that a is 0.
Not true. I tried exactly the same code and 'a' is 25. Please
show your actual code included the event where the code is
executed. You missed a couple of semicolons, too.
Steve.
 

{smallsort}