How does @LEN() relate to the Printstring() font size? Does it relate at all?
Here's the problem I'm trying to solve: I have a multi-line field on my Customer form that contains directions to the customer location. It holds about 5 lines of text as displayed on the screen (but can contain more as the user keeps typing). This data prints onto my Workorder form (paper form) into an area that is about 8 inches wide (Newpage is set at 850,1100), and about a half inch high. The page extent and margins are set so it wraps nicely, and will hold about 4 lines of SanSerif text at a font size of 14 (small, but not too small to read, using my Epson dot-matrix printer).
I've been working on a subroutine that will measure the extent of the contents of the Directions field, compare it to a limit, warn the user if its too long for the Workorder, and throw him back into the field as he exits. So far, I have this (borrowed code from someone's post or maybe Inside Sesame):
GLOBAL CODE
// Checks the Directions length
Subroutine CheckDirLength(item as String)
sFont = "SanSerif"
sSize = 14
sAvailSpace = ???
PrintString(ThisElement, 0, 0, 0, sFont, sSize, 1)
If @PageExtentX() > sAvailSpace
{
@Msgbox("The Directions are too long for the Workorder.",
"It is " + @PageExtentX() + " units long.",
"The available space is " + sAvailSpace + ".")
ThrowFocus(ThisElement)
}
End Subroutine
DIRECTIONS :: on-element exit
// Checks the Directions length
CheckDirLength(ThisElement)
The ??? is where I'm stumped. If I fill the Directions field with text, @LEN() can count the characters, but I can't figure out how to relate that to Sanserif 14 at 8 inches with a four-line wrap. Is there a rule-of-thumb for figuring this kind of thing out? Is it just a matter of filling the field and grinding out multiple test prints to see where to cut it off? Mixtures of capitals and lower case throw an extra wrinkle into the mix.
Any help would be appreciated.