Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clipper to VFP printing weirdness

Status
Not open for further replies.

BobMorris

Programmer
Jul 6, 2001
32
0
0
US
I'm converting a Clipper app to VFP. The printing is acting oddly.

For example, the following PRG prints fine as a stand-alone, yet does not print at all when I include it in the application - all I get is a blank piece of paper ejected. The programs calling this are plain vanilla menus.

I'm baffled. Also, sometimes a report will spool to the printer, but not print until I leave VFP.

Ideas?

===
This prints fine as a standalone but not in the application.

SET DEVICE TO SCREEN
SET PRINT OFF
CLOSE ALL

USE codemstr INDEX cdkey

STORE 0 TO mcount
STORE 1 TO mpage
STORE 65 TO MLINE
STORE msysname TO header1
STORE "Comment Code Master File List" TO header2

SET PRINT ON
SET DEVICE TO PRINT PROMPT

DO WHILE .NOT. EOF()

IF MLINE > 56
@ 1, 0 SAY "Time " + TIME()
@ 1,(80 - LEN (TRIM(mpcname))) / 2 SAY mpcname
@ 1, 65 SAY "Page " + STR(mpage,3)
@ 2, 0 SAY "Date "
@ 2, 5 SAY DATE()
@ 2,(80 - LEN (TRIM(header1))) / 2 SAY header1
@ 3,(80 - LEN (TRIM(header2))) / 2 SAY header2
@ 5, 0 SAY "Code Comment"
STORE mpage + 1 TO mpage
STORE 6 TO MLINE
ENDIF

@ MLINE, 0 SAY cdcode
@ MLINE, 7 SAY cddesc
STORE MLINE + 1 TO MLINE
STORE mcount + 1 TO mcount

SKIP

ENDDO

STORE MLINE + 1 TO MLINE
@ MLINE, 0 SAY "Total "
@ MLINE, 7 SAY mcount PICTURE "999"

EJECT
SET DEVICE TO SCREEN
SET PRINT OFF

RETURN

Bob Morris
 
BobMorris

My suggestion is if you are going to do a conversion, do it properly and completely. You are using FPD (FoxPro DOS) tecnique of producing a report. You may want to consider an up-to-date method of using the VFP report designer. You problem is most likely related to the fact that you are trying to access the printer directly whilst VFP uses Windows printer drivers. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
Good point. It reminded me of how I fixed the same error in a Clipper to xBase conversion.

So, I changed the code, writing the report to a text file then use TYPE TO PRINTER command to print it. Works great, as everything is handled in a Windows-like way now. Bob Morris
 
So, I changed the code, writing the report to a text file then use TYPE TO PRINTER command to print it. Works great, as everything is handled in a Windows-like way now.

Ok, if you say so, let pretend that using @1,1 say "Hello" to a text file is the "windows ways" of doing things. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first or check this link
 
<< I'm baffled. Also, sometimes a report will spool to the printer, but not print until I leave VFP. >>

If you see this happen more often then you'd like, just add a line after your print routine that is simply SET PRINTER TO. That seems to tell VFP that the print stream really is complete and it can get released in the print spooler to actually print without exiting VFP.

==Carl
Carl Warner
VFUG Officer,
PS I have done some Clipper conversions myself.
 
Just to add to Carl's response, I've found that under certain variants of OS's / printer spooler setups it's sometimes necessary to actually use TWO (2) SET PRINTER TO commands in a row. I always use two now, since I've never seen it cause a problem, and it's the only thing that works sometimes!

Rick


 
Thanks to all who helped. IF the client wants the reports done in the VFP report form, then I will, otherwise my kludge is working fine.

Two SET PRINTER TO commands, eh. How weird!

Bob Morris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top