Evan, you can put this code in a builder, or for faster execution, can put it in a program file, and have your startup program say:
ON KEY LABEL F5 DO Sizer WITH SYS(1270)
Then hitting F5 will pass the textbox object to the program, and the program iwll size it.
>Thanks Neil, but I want to do this in the form designer, not at runtime.
>
>>I use this code to do near enough what you want. I think their are lots of variations on this theme though.
>>
>>LOCAL loTextBox
>>LOCAL lnLength
>>LOCAL lnWidth
>>
>>loTextBox = ThisForm.Control
>>lnLength = fsize(lcField, lcAlias)
>>
>>*!* Work out the width based on the current font.
>>lnWidth = txtWidth(replicate("w", lnLength), ;
>> loTextBox.FontName, loTextBox.FontSize) * fontmetric(6, ;
>> loTextBox.FontName, loTextBox.FontSize) + 2
Erik Moore
Clientelligence