can you restrict a field to lines instead of characters

  • Thread starter Thread starter jmh
  • Start date Start date
J

jmh

can you restrict a field to lines instead of the number of characters without
changing the size of the field?
 
jmh said:
can you restrict a field to lines instead of the number of characters without
changing the size of the field?


No, because the number of lines depends on all the font
property settings wherever the field is displayed.
 
can you restrict a field to lines instead of the number of characters without
changing the size of the field?

Could you explain what you mean by "lines"???

If you're trying to control the screen space occupied by text in a field, it's
very difficult. Different fonts have different sizes for the characters, and -
except in fixed-pitch fonts, which aren't used much these days - the size will
be very different for "MMMMMMMMMM" and "lllllllll".
 
I want to be able to restrict the size of the field to a finite number of
lines but not have it based on character size. I want to be able to have a
space that will let the user add 15 lines of text and my field remain a
constant size.
 
I want to be able to restrict the size of the field to a finite number of
lines but not have it based on character size. I want to be able to have a
space that will let the user add 15 lines of text and my field remain a
constant size.

I don't know any way to reliably do so. Even if the user is using the same
font there's a chance that they're using a different version of that font.

I'll ask the other experts if they have any suggestions.
 
Thank you

John W. Vinson said:
I don't know any way to reliably do so. Even if the user is using the same
font there's a chance that they're using a different version of that font.

I'll ask the other experts if they have any suggestions.
 
Not exactly elegant, but would you be able to setup 15 different unbound
textboxes, set some formatting so it looks like its all the same field? Then
take the values and contencate them to do your internal work with. You would
probably want to put some restriction on the length of each line, but there's
no way around that... 15 lines at 2million characters long won't work, either
way you'll need something there.

Here's another even more hairbrained idea... it may be possible to obtain
the properties of the currently selected font (I know you can get the current
font, and I've seen some font stuff buried away in a few Lebans functions,
though admittedly, I have no idea what they do). But, if you could get that
info, maybe you could perform some calculations based on font properties and
the width of the control, and dynamically limit the amount of characters
allowed so that it won't exceed 15 lines or wrap.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
Back
Top