[comp.databases] Clipper SETPRC

nam2254@dsacg2.dsac.dla.mil (Tom Ohmer) (11/28/90)

An application that I have been tasked to modify uses the SETPRC()
function in a few places.  The use of and need for this function
is not obviously clear to me.  I am familiar with using @...SAY
commands to print text and have read the manual and Straley's book,
but would appreciate an experienced guru's explanation.  Many thanks
in advance.
-- 
Tom Ohmer @ Defense Logistics Agency Systems Automation Center,
            DSAC-AMB, Bldg. 27-6, P.O. Box 1605, Columbus, OH  43216-5002
UUCP: ...osu-cis!dsac!tohmer   INTERNET: tohmer@dsac.dla.mil
Phone: (614) 238-8059   AutoVoN: 850-8059   #include <stdsclmr.h>

nfs0294@dsacg2.dsac.dla.mil (Glen Midkiff) (11/29/90)

From article <2758@dsacg2.dsac.dla.mil>, by nam2254@dsacg2.dsac.dla.mil (Tom Ohmer):
> An application that I have been tasked to modify uses the SETPRC()
> function in a few places.  The use of and need for this function
> is not obviously clear to me.  I am familiar with using @...SAY
> commands to print text and have read the manual and Straley's book,
> but would appreciate an experienced guru's explanation.  Many thanks
> in advance.
> -- 
My understanding of the SETPRC() function is that it allows you to reset 
the current print position (row,col).  For instance, if you send a 
printer initialization string to the printer with an @...SAY, then write
your first report line with an @ 0,0 SAY ...., you will get a page eject
because after the SAY of the init string, your current position is equal
to the number of characters in the init string.  In order to print at 0,0
you will get a page eject.  However, if you first do a SETPRC(0,0) before 
printing the first line, then the internal print position is at 0,0 so no eject is required.  I hope I am not misleading you, by giving bum
info, but this seems to be the way it works for me.

-- 
 |-----------------------------------------------------------------------|
 |Glen Midkiff   osu-cis!dsac!gmidkiff                                   |
 |From the Internet: gmidkiff@dsac.dla.mil                               |
 |Phone: (614)-238-9643 @DLA, Systems Automation Center, Columbus, Oh.   |

timk@xenitec.on.ca (Tim Kuehn) (11/29/90)

<2758@dsacg2.dsac.dla.mil> nam2254@dsacg2.dsac.dla.mil (Tom Ohmer) writes:
>An application that I have been tasked to modify uses the SETPRC()
>function in a few places.  The use of and need for this function
>is not obviously clear to me.  I am familiar with using @...SAY
>commands to print text and have read the manual and Straley's book,
>but would appreciate an experienced guru's explanation.  Many thanks
>in advance.

From the TF clipper manual, pg 6-16 "SETPRC(<expn1>,<expn2>) Sets the 
internal PROW() and PCOL() values to <expn1> and <expn2>"

See also pg 6-170 for more detail. 

This function is used when you want to define where the current printer
row, col position is yourself instead of having to always use xBASE's
(sometimes incorrect) values of prow() and pcol().

>Tom Ohmer @ Defense Logistics Agency Systems Automation Center,
>            DSAC-AMB, Bldg. 27-6, P.O. Box 1605, Columbus, OH  43216-5002
>UUCP: ...osu-cis!dsac!tohmer   INTERNET: tohmer@dsac.dla.mil
>Phone: (614) 238-8059   AutoVoN: 850-8059   #include <stdsclmr.h>

--------------------------------------------------------------------------
Timothy D. Kuehn    TDK Consulting Services  "Where Quality is Guaranteed"
timk@xenitec.on.ca  uunet!watmath!xenitec!timk 119 University Ave. East
office: (519)-888-0766 fax: (519)-747-0881     Waterloo, Ontario
Home:   (519)-742-2036			       Canada. N2J 2W1 
Contract services available in Dos/Unix/Xenix - SW & HW. Clipper, Foxbase,
FoxPro, C, Pascal, Fortran, Assembler etc.           "Manual? What's that??"

ericp@beach.csulb.edu (Eric Pederson CSE) (12/04/90)

<2758@dsacg2.dsac.dla.mil> nam2254@dsacg2.dsac.dla.mil (Tom Ohmer) writes:
>An application that I have been tasked to modify uses the SETPRC()
>function in a few places.  The use of and need for this function
>is not obviously clear to me.  I am familiar with using @...SAY
>commands to print text and have read the manual and Straley's book,
>but would appreciate an experienced guru's explanation.  Many thanks
>in advance.

It's usually handy if you are sending control character sequences (eg.
underline on/off, etc) that bump the internal prow()/pcol() values but
don't actually move the printhead.

Say for example you want a report heading to contain actual printer 
underlines (not just dashes on the next line).  Say that the report
contains two columns, one starting in print position 10, the next in
print position 25.  In operation,  if you @ SAY things in consecutive
columns, xBASE outputs the appropriate amount of spaces to get to the
next column by using it's internal pcol() counter.  However, if the
strings you send to turn underlining on and off contain a total of say
6 characters, xBASE will think the printhead is over 6 more columns
than it acutually is.  You set the internal column pointers to the
correct positions using setprc().

@ LROW, 10 SAY UNDERLINEON+LHEADING1+UNDERLINEOFF
SETPRC(LROW,10+LEN(LHEADING))
@ LROW, 25 SAY UNDERLINEON+LHEADING2+UNDERLINEOFF
LROW = LROW + 1

This is a contrived example, but in complicated reports, setprc()
does come in handy.  SETPRCing the row value is handy if you send
a form-feedish character to the printer that you want to let xBASE
know about.

Eric Pederson - CSULB
ericp@beach.csulb.edu