Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting a Printer programatically
Message
 
 
À
11/03/2007 10:27:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01202530
Message ID:
01235430
Vues:
19
Thanks.

>I recommend adding a printer selection feature as follows:
>
>
>DEFINE POPUP SetReport SHORTCUT RELATIVE ;
>    FROM MROW(),MCOL() ;
>    TITLE "Report Options" MARGIN
>
>DEFINE BAR 1 OF SetReport PROMPT "Set Printer \<Options"
>DEFINE BAR 2 OF SetReport PROMPT "How \<Many Copies?"
>DEFINE BAR 3 OF SetReport PROMPT "\<Cancel Printing"
>DEFINE BAR 4 OF SetReport PROMPT "\<Select Printer"
>ON BAR 4 OF SetReport activate POPUP PickPrinter
>DEFINE BAR 5 OF SetReport PROMPT "Send Report to \<Printer"
>ON SELECTION POPUP SetReport DEACTIVATE POPUP
>
>*- begin Select printer from this Pop-up
>*****************************************************
>LOCAL i, laprinters(1)
>DEFINE POPUP PickPrinter SHORTCUT RELATIVE ;
>    TITLE "Select printer" MARGIN
>
>FOR m.i = 1 TO APRINTERS(m.laprinters,0)
>	DEFINE BAR (m.i) OF PickPrinter PROMPT (m.laPrinters(m.i,1))
>ENDFOR
>On Selection Popup PickPrinter  Set printer to name (Prompt())
>*- end Select printer from this Pop-up
>
>*****************************************************
>DO WHILE .T.
>   ACTIVATE POPUP SetReport
>   IF BAR() = 1
>      SYS(1037)
>   ENDIF
>   IF BAR() = 2
>      LOCAL nCopies
>      nCopies = ''
>      nCopies = VAL(INPUTBOX("Specify Number of Copies ?","","1"))
>      IF ! nCopies => 1
>         =MESSAGEBOX("Specify Number of Copies as number",0+16,"Error")
>         KEYBOARD '{M}'
>         nCopies = 1
>      ELSE
>         nCopies = 1
>      ENDIF
>      _pCopies = nCopies
>   ENDIF
>   IF BAR() = 3
>      SET DEVICE TO SCREEN
>      EXIT
>   ENDIF
>   IF BAR() = 5
>      ** DO PRINTING JOB
>      EXIT
>   ENDIF
>ENDDO
>
>
>Glenn
>
>
>>
DEFINE POPUP SetReport SHORTCUT RELATIVE ;
>>    FROM MROW(),MCOL() ;
>>    TITLE "Report Options" MARGIN
>>
>>DEFINE BAR 1 OF SetReport PROMPT "Set Printer \<Options"
>>DEFINE BAR 2 OF SetReport PROMPT "How \<Many Copies?"
>>DEFINE BAR 3 OF SetReport PROMPT "\<Cancel Printing"
>>DEFINE BAR 4 OF SetReport PROMPT "Send Report to \<Printer"
>>ON SELECTION POPUP SetReport DEACTIVATE POPUP
>>*****************************************************
>>DO WHILE .T.
>>   ACTIVATE POPUP SetReport
>>   IF BAR() = 1
>>      SYS(1037)
>>   ENDIF
>>   IF BAR() = 2
>>      LOCAL nCopies
>>      nCopies = ''
>>      nCopies = VAL(INPUTBOX("Specify Number of Copies ?","","1"))
>>      IF ! nCopies => 1
>>         =MESSAGEBOX("Specify Number of Copies as number",0+16,"Error")
>>         KEYBOARD '{M}'
>>         nCopies = 1
>>      ELSE
>>         nCopies = 1
>>      ENDIF
>>      _pCopies = nCopies
>>   ENDIF
>>   IF BAR() = 3
>>      SET DEVICE TO SCREEN
>>      EXIT
>>   ENDIF
>>   IF BAR() = 4
>>      ** DO PRINTING JOB
>>      EXIT
>>   ENDIF
>>ENDDO
>>
>>
>>>Hi.
>>>I have a report where a different form layout is printed , depneding on who the customer is.
>>>Si I have a loop like:
>>>Sele MyAlias
>>>Do while not eof()
>>> Copy 1 record to ReportFile
>>> Use reportFile
>>> Do case
>>> Case 1-- Print FormA
>>> Case 2-- print FormB
>>> Case 3-- Prnt FormC etc
>>> Sele MyAlias
>>> Skip
>>>Enddo
>>>
>>>So I want to be able to select the printer, and its settings at the start of the loop
>>>Options i've loked at
>>>Sys(1037) Lets me select printer but does not return a printer name so I can set printer to
>>>Getprinter.. lets me select a printer name that I can set but does not allow me to change other properties e.g. the number of copies.
>>>
>>>Is there any printer dialogue that can be accessed from within VFP that mimics exactly the Windows Printer dialogue ?
>>>Regards,
>>>Gerard
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform