Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check the length of a text string
Message
From
23/11/1998 17:23:45
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00160649
Message ID:
00160682
Views:
19
>I seem to be having a problem calculating the length of a text string. I tried the txtwidth() function and and fontmetric() function as shown in the txtwidth() help examle and I am getting nowhere. All I want to do is find the lenght of a string so I can auto size the box or command button it appears in.
>
>As usual, many thanks to all who help.
>
>John J. Henn.


Hi,

If you want a quick (and dirty) work around, place a label with autosize set to .T. behind the textbox or command button (the visible property must be set to true for the autosize to work).

When a new value is stored to the textbox value or command button caption, take this value, store it to the label caption, then reset the width of the textbox or commandbutton to the width of the label. You will need to add about 8 to the width of the textbox or command button.

OK, so it is a bandaid, but it works...

Erin
Previous
Reply
Map
View

Click here to load this message in the networking platform