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>hpcenter()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
hpCenter()

Center a string horizontally on the page


Syntax

hpCenter(<cString> [,<nRow> [,<nCol> [,<cUnits>]]])


Parameters

<cString>
The character string to be centered.

<nRow>
The row that the string is to be centered at.  hpCenter()
will accept fractional values for the row coordinate,
accurate to four decimal places.  If omitted, the string
will be centered at the current line.

<nCol>
The column coordinate that the string is to be centered
at.  You can specify <nCol> down to four decimal
places.  If omitted, <nCol> will default to the center of
your page, regardless of what size paper or orientation
you are using.

<cUnits>
The units of measurement to used for positioning.
Defaults to 'R'.  Values can be:
"R"     Rows and Columns
"I"     Inches
"M"     Millimeters


Returns

0
Successful.

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

-12
Wrong number of parameters passed.

-17
Incorrect parameter type was passed.


Remarks

hpCenter() is very useful for centering titles and page numbers;  and if
you specify <nCol>, hpCenter() makes it easy when performing tasks
such as printing headings over columns.  What if you need to center a 9
character string over a 10 character string?  With hpCenter() you don't
have to worry, you'll get true centering every time.

Note:  To center proportional fonts use hpICenter().


Support By

All HP Laserjet Printers


Example

To print titles and page numbers at the center of the page:
hpCenter('Title')  // centered on current line
hpCenter('Heading', 2, 10) // centered on line 2,
                           // column 10
hpCenter('Page  1', 59)    // centered on line 59

hpCenter() can even be used in combination with Escape!'s other
functions:

hpCenter(hpBold('Center & Bold this string'))

hpCenter(hpUnderln('Center & Underline this string'),1)

Suppose you have a column of totals (with a width of 4) and you need to
center the word "Total" over this column ("Total" has a character width
of 5).  You can easily get true centering like this:
.
.
.
hpCenter('Total', 1, 21.5)
nLine := 2
DO WHILE .NOT. EOF()
  .
  .
  .
  @ nLine,20 SAY nTotal
  nLine++
  SKIP
ENDDO

See Also: hpICenter() hpRJust() hpIRJust()

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