![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

I am having trouble retrieving print dialog parameters set by a user. =
In the sample code below, I can't seem to retrieve the number of copies =
selected by the user in the print dialog generated by =
CHOOSE-PRINTER-PAGES. =20
It would seem that changing the number of copies from the default of 1 =
to some other value would set VALUE1 to the selected number. I always =
seem to get the default value of 1.
\ SAMPLE CODE STARTS HERE
\ =3D=3D=3D "Included" print definitions=20
CLASS PRINTDIALOG =20
VARIABLE StructSize
VARIABLE Owner
VARIABLE DevMode
VARIABLE DevNames
VARIABLE DC
VARIABLE Flags
HVARIABLE FromPage
HVARIABLE ToPage
HVARIABLE MinPage
HVARIABLE MaxPage
HVARIABLE Copies
VARIABLE Instance
VARIABLE CustData
VARIABLE PrintHook
VARIABLE SetupHook
VARIABLE PrintTemplateName
VARIABLE SetupTemplateName
VARIABLE PrintTemplate
VARIABLE SetupTemplate
: Construct ( -- )
[ THIS SIZEOF ] LITERAL ADDR OVER ERASE StructSize ! ;
END-CLASS
[UNDEFINED] CURRENT-DC [IF]
\ User Vars
#USER
CELL +USER CURRENT-DC \ Device Context
TO #USER
: MY-DC ( -- hDC ) CURRENT-DC @ ;
: IS-MY-DC ( hDC -- ) CURRENT-DC ! ; \ Set at BeginPaint etc
: GET-MY-DC ( -- ) HWND GetDC IS-MY-DC ;
: RELEASE-MY-DC ( -- ) HWND MY-DC ReleaseDC DROP ;
[THEN]
PRINTDIALOG BUILDS pd
: DEFAULT-PRINTER ( -- )
0 pd DevMode ! 0 pd DevNames !
PD_RETURNDC PD_RETURNDEFAULT OR pd Flags !
PRINTDIALOG SIZEOF pd StructSize !
pd StructSize PrintDlg 0=3D IOR_PRT_NODEFPRINTER ?THROW ;
: CHOOSE-PRINTER-PAGES ( n -- flag )
1 pd MinPage H! DUP pd MaxPage H!
1 pd FromPage H! pd ToPage H!
PD_RETURNDC PD_NOSELECTION OR pd Flags !
pd StructSize PrintDlg ;
DOCINFO BUILDS MY-DI
: START-OF-DOC MY-DC MY-DI ADDR StartDoc 0> NOT IOR_PRT_BADSTARTDOC =
?THROW ;
: START-OF-PAGE MY-DC StartPage 0> NOT IOR_PRT_BADSTARTPAGE ?THROW ;
: END-OF-PAGE MY-DC EndPage 0> NOT IOR_PRT_BADENDPAGE ?THROW ;
: END-OF-DOC MY-DC EndDoc 0> NOT IOR_PRT_BADENDDOC ?THROW ;
: MY-DEFAULT-PRINTER DEFAULT-PRINTER pd DC @ IS-MY-DC ;
\ =3D=3D=3D print definitions from my application
PRINTING +ORDER \ Need stuff from Preview.f
0 VALUE VALUE1
: (PRINT-REPORT) ( -- ) 0 TO VALUE1
MY-DEFAULT-PRINTER =20
1 CHOOSE-PRINTER-PAGES IF
pd Copies H@ TO VALUE2
Z" My Report" SET-DOC-NAME
START-OF-DOC
.REPORT
END-OF-DOC
THEN
MY-DC DeleteDC DROP ( Delete Printer DC ) ;
\ Note: USE-DISPLAY vectors I/O words (crlf) and (out) to the display
: PRINT-REPORT ( -- )
['] (PRINT-REPORT) CATCH ?DUP IF=20
USE-DISPLAY (crlf) (THROW)(out)=20
THEN ;
PRINTING -ORDER
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Thu Dec 11 2003 - 14:08:23 PST
This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:34 PST