Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine a wrapped word label's height?
Message
 
To
25/09/2006 10:17:37
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01155729
Message ID:
01157058
Views:
33
>>I think the problem might be that you're assigning the caption before the container is done with its Init in that case. IOW, the container hasn't been instantiated yet, so you can't change its height. You can check this by seeing what you get back from THIS.HEIGHT in the container's Init before you try to assign the caption.
>
>Ok, I tried assigning the caption in a custom method of the form. By that time, the containers' Inits are complete correct? Still a no go :(
>

I don't know. It depends when you call that custom method.

>Interestingly, check this out. I've put a container on a form. In that container I put a label with Autosize=.T., Wordwrap=.T., Caption="Test". I sized the label's width to 80 (narrow enough to force a wordwrap to occur when I set the caption later). In the form's Init, I set the label's Caption="This is a long caption to test the wordwrap feature".
>
>From the debugger, when I step thru the form's init to check the label's height, it starts out at 17, the default. After the caption is changed to the longer one, the height is still 17. It does not seem to know that the wordwrap took place. Bug?

Maybe. It seems that's the case with anything you call before the form is painted. For example, if I create a form with a label that has all the properties set to make it stretch, and I set a label's caption to "Test", then display the height in the Init of the label, it's 17. If I make the label's caption a lot longer in the form's Init and then display the label's height, it's still 17. If I move that code to the form's Activate method, then I get the correct label height.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform