Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Escape! V3.0 - <b>hpjustcount()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
hpJustCount()

Count the number of lines in a character string


Syntax

hpJustCount(<cString> [, <nLength> [, <cUnits>]])


Parameters

<cString>
The string or memo field to count.

<nLength>
The length of each line of text.  If using a fixed spaced
font, this value may be specified by number of
characters, inches or millimeters.  If using a
proportional font, this value must be specified in inches.
If omitted, <nLength> will default to the width of the page.

<cUnits>
The units of measurement to be used for the line length
parameter.  If <cUnits> is omitted, the units will default
to Rows and Columns.  Values for <cUnits> can be:
"R"     Rows and Columns
"I"     Inches
"M"     Millimeters


Returns

<n>
The number of lines there will be when fully justifying
<cString> based on <nLength>.

-10
Font information is missing.  hpSetFont( ) must be called first.

-17
Incorrect parameter type was passed.


Remarks

hpJustCount() is a replacement for Clipper's MLCOUNT() function.  It is
used in conjunction with hpJustLine() to fully justify memo fields or
strings using proportionally (or fixed) spaced fonts.

Because character widths vary for proportional fonts, word wrapping is
not accurate using Clipper's MEMOLINE() and MLCOUNT() functions.
But now, with hpJustLine() and hpJustCount(), wrapping and full
justification of proportional fonts is easy.  The concept behind using
these functions is to first count the number of lines there will be when
your string is fully justified.  Then use hpJustLine() to extract the lines
to be printed.


Support By

All HP LaserJet printers


Example

To fully justify a memo field named MEMO, with a proportional font,
beginning at row 10, col 10, and a line length 6 inches:

hpConfig( )
hpSetFont( 'HELV 12B', 'Z')
nRow        := 10
nStartCol   := 1
nLineLength := 6
nLines := hpJustCount( MEMO, nLineLength, "I")
FOR nLine := 1 TO nLines

See Also: hpWrap() hpJust() hpJustLine() hpMemoLine() hpMLCount()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson