Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print Dialog with Number of Copies
Message
From
17/05/2001 12:53:06
David Fluker
NGIT - Centers For Disease Control
Decatur, Georgia, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00508337
Message ID:
00508400
Views:
32
>>>Is there a Fox command for bringing up a print dialog that allows the user to select number of copies?
>>>
>>>I've tried SYS(1037)and GetPrinter. SYS(1037) offers more than GetPrinter, but neither offer number of copies.
>>>
>>>TIA,
>>>Chuck
>>
>>The dialogue I get from the command below gives me a # of copies option:
>>
>>report form myreport to printer prompt
>>
>>The printer is an HP Laser 5.
>
>Thanks Mark. Actually, in my post, I should've asked is there a way to do this other than with PRINTER PROMPT.
>
>What I'm trying to accomplish is to have the user tell me which printer he intends to use before I go to REPORT FORM so that I can get a total page count and express "Page x of y" when the report prints. Here's my coding example at present (which isn't offering a number of copies option):
>
>
>* Print Report
>SELECT curHatFiRep && CURSOR containing records to report
>PUBLIC mTotalPages && Page Count mvar
>STORE 1 TO mTotalPages && Initial value to eliminate error with REPORT FORM.
>* PRINTER PROMPT with =SYS(1037)...
>* Otherwise, you may have an issue with the printable area
>* being different between the default printer and the one
>* chosen by the user. Potentially, this could mean that the
>* "TO FILE" report would have a slightly different page count
>* than the "TO PRINTER" report because the number of lines
>* that can fit on the page may be slightly different.
>=SYS(1037)
>REPORT FORM HatFiRep TO FILE TempRept.prn NOCONSOLE
>DELETE FILE TempRept.prn
>STORE _PageNo TO mTotalPages && Actual value.
>REPORT FORM HatFiRep TO PRINTER NOCONSOLE
>
>
>I hate to bring up the printer dialog again by adding TO PRINTER PROMPT in the REPORT FORM statement. At best, it's a hassle for the user to have to experience 2 printer dialog boxes at report time. At worst, it looks like I'm not a clean programmer and it may mess up the page count on the report.


You can create a Report dialog box that lets the user select a printer and choose the number of copies. Store the number of copies in the _PCopies system variable. Then surround your second REPORT FORM with PRINTJOB ENDPRINTJOB. It's been a while since I used it, but I think it should work this way. Your code would look like this...
*:Call printer selection dialog, store number of copies to _PCopies

REPORT FORM HatFiRep TO FILE TempRept.prn NOCONSOLE
DELETE FILE TempRept.prn
STORE _PageNo TO mTotalPages && Actual value.
PRINTJOB
   REPORT FORM HatFiRep TO PRINTER NOCONSOLE
ENDPRINTJOB
David.
Previous
Reply
Map
View

Click here to load this message in the networking platform