REPORT FORM xxx TO PRINTER PROMPT
poPrint.ReportEnd
PRIVATE; poPrint THIS.glPrinted = .F. poPrint = THIS && Assuming THIS is the printhandler with the method! REPORT FORM .... IF THIS.glPrinted THEN ?'Report send to spooler' ELSE &&THIS.glPrinted ?'Report not (completely) printed' ENDIF &&THIS.glPrinted
LPARAMETERS; tlPrint *FYI: #DEFINE dcPrintWindow_uk 'Printing...' #DEFINE dcPrintWindow_deu 'Drucken...' LOCAL; llEvent AS BOOLEAN #IF VERSION(5)>=900 THEN *not much use before VFP9, much trouble before VFP8 LOCAL; lnEvents AS INTEGER,; lnEvent AS INTEGER LOCAL ARRAY; laAvents(1,4) lnEvents = AEVENTS(laEvents,THIS) FOR lnEvent = 1 TO lnEvents IF laEvents(lnEvent,1) AND laEvents(lnEvent,4)=('REPORTEND') THEN llEvent = .T. EXIT ENDIF &&laEvents(lnEvent,1) AND laEvents(lnEvent,4)=('REPORTEND') ENDFOR &&lnEvent IF llEvent THEN IF !EMPTY(AEVENTS(laEvents,0)) THEN *supress VFP 8 style call from frx, if the summary band still holds the call DO CASE CASE !laEvents(1,1).BASECLASS='Reportlistener' CASE laEvents(1,2)=('BEFOREREPORT') THIS.glPrinted = .T. CASE laEvents(1,2)=('CANCELREPORT') THIS.glPrinted = .F. CASE laEvents(1,2)=('ONPREVIEWCLOSE') AND !tlPrint THIS.glPrinted = .F. ENDCASE ENDIF &&!EMPTY(AEVENTS(laEvents,0)) ENDIF &&llEvent #ENDIF &&VERSION(5)>=900 THEN IF !llEvent THEN *this is for REPORTBEHAVIOR 80 and needs a call to this method in summary band #IF VERSION(5)<800 THEN *before Version 8 *if you use other language add up THIS.glPrinted = ; WEXIST(dcPrintWindow_Deu) OR; WEXIST(dcPrintWindow_Uk) #ELSE &&VERSION(5)<800 *Version 8 and beyond. We have a problem with NODIALOG clause *so we use new sys function: THIS.glPrinted = SYS(2040)="2" #ENDIF &&VERSION(5)<800 ENDIF &&llEvent
toListener = .NULL. DO (_REPORTOUTPUT) WITH tnListenerType,toListener THIS.glPrinted = .F. BINDEVENT(toListener,'BeforeReport' ,THIS,'ReportEnd',1) BINDEVENT(toListener,'CancelReport' ,THIS,'ReportEnd',1) BINDEVENT(toListener,'OnPreviewClose',THIS,'ReportEnd',1) REPORT FORM myReport OBJECT toListener UNBINDEVENTS(toListener,'OnPreviewClose',THIS,'ReportEnd') UNBINDEVENTS(toListener,'CancelReport' ,THIS,'ReportEnd') UNBINDEVENTS(toListener,'BeforeReport' ,THIS,'ReportEnd') *If THIS.glPrinted is .F., the report was not send to any spooler