Leban's "string lengths in twips"

B

Bill

Encountered an interesting condition when using Steven's
fTextWidth function in a report:

intTemp = fTextWidth(Me.MyControl) 'Get string length in twips

Then,

Me.MyControl.Width = intTemp 'Adj Ctl width per string

The resulting display of MyControl shows a truncated string,
i.e., having adjusted the width of the control the string is too
long to fit in the control adjusted exactly to its length.

Do the widths of controls have some sort of obscured amount
of overhead?

Bill
 
M

Marshall Barton

Bill said:
Encountered an interesting condition when using Steven's
fTextWidth function in a report:

intTemp = fTextWidth(Me.MyControl) 'Get string length in twips

Then,

Me.MyControl.Width = intTemp 'Adj Ctl width per string

The resulting display of MyControl shows a truncated string,
i.e., having adjusted the width of the control the string is too
long to fit in the control adjusted exactly to its length.

Do the widths of controls have some sort of obscured amount
of overhead?


Yes they do. The control's BorderStyle and BorderWidth is
always a consideration in this kind of situation. I usually
set the text box Width to the fTextWidth value plus a fudge
factor somewhere in the range of 20 to 50 twips.
 
B

Bill

Thanks Marsh, I didn't think of BorderStyle and what
it might require or keep in reserve. If in this case I had
a boarder other than a transparent one, it might have
dawned on me to take that into consideration.

As it is, I had set the TB width to 110% of what the
text string measured while awaiting a reply post, what
is more-or-less what you've suggested.

And yes (from your other post), Steven's functions are
so simple to use it makes no sense to me to use anything
else at this point.

Thanks again,
Bill Stanton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top