Buenos días para todos,
Requiero ejecutar una función al momento de cerrar el preview de la impresión, justo al momento en que se cierre la ventana.
De antemano gracias
leandro wrote:Buenos días para todos,
Requiero ejecutar una función al momento de cerrar el preview de la impresión, justo al momento en que se cierre la ventana.
//Preview
IF ::oPrn:lMeta = .T. .and. Empty( ::oPrn:cFile )
IF ::lCheck = .T.
::oPrn:End()
SYSREFRESH()
ELSE
IF ::lShowInfo = .T.
::oInfoDlg:End()
::lShowInfo := .F.
ENDIF
RPreview( ::oPrn )
ENDIF
ELSE
PrintEnd()
//::oPrn:End()
ENDIF
//----------------------------------------------------------------------------//
function RPreview( oDevice, oReport )
local oPreview
if bUserPreview == nil
oPreview := TPreview():New( oDevice, oReport )
oDevice:oPreview := oPreview
oPreview:Activate()
else
Eval( bUserPreview, oDevice, oReport )
endif
return nil
#include "fivewin.ch"
#include "report.ch"
REQUEST DBFCDX
function Main()
local oRep, oFont
SetCustomPrintPreview( { |oDevice,oReport| MyPreview( oDevice, oReport ) } )
USE CUSTOMER NEW SHARED VIA "DBFCDX"
SET FILTER TO RECNO() <= 20
GO TOP
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
REPORT oRep PREVIEW FONT oFont
COLUMN TITLE "NAME" DATA FIELD->FIRST
COLUMN TITLE "CITY" DATA FIELD->CITY
ENDREPORT
oRep:bInit := { || CUSTOMER->( DBGOTOP() ) }
ACTIVATE REPORT oRep
RELEASE FONT oFont
return nil
function MyPreview( oDevice, oReport )
local oPreview
oPreview := TPreview():New( oDevice, oReport )
oDevice:oPreview := oPreview
//oPreview:Activate()
MyPreviewActivate( oPreview )
return nil
#define GO_POS 0
#define GO_UP 1
#define GO_DOWN 2
#define GO_LEFT 1
#define GO_RIGHT 2
#define GO_PAGE .T.
function MyPreviewActivate( Self )
local hWndMain
if ::oWnd == nil
return nil
endif
if ::bSetUp != nil
Eval( ::bSetUp, Self, ::oWnd )
endif
ACTIVATE WINDOW ::oWnd MAXIMIZED ;
ON RESIZE ( ::PaintMeta(), ::ResizeListView() ) ;
ON UP ::VScroll( GO_UP ) ;
ON DOWN ::VScroll( GO_DOWN ) ;
ON PAGEUP ::VScroll( GO_UP, GO_PAGE) ;
ON PAGEDOWN ::VScroll( GO_DOWN, GO_PAGE) ;
ON LEFT ::HScroll( GO_LEFT ) ;
ON RIGHT ::HScroll( GO_RIGHT ) ;
ON PAGELEFT ::HScroll( GO_LEFT, GO_PAGE ) ;
ON PAGERIGHT ::HScroll( GO_RIGHT, GO_PAGE ) ;
VALID ( ::oWnd:oIcon := nil ,;
::oFont:End() ,;
::oCursor:End() ,;
::oMeta1:End() ,;
::oMeta2:End() ,;
::oDevice:End() ,;
::oHand:End() ,;
If( Empty( ::oImageList ),, ( ::oImageList:End(), ::oImageList := nil ) ),;
If( ! Empty( ::oImageListPages ), ::oImageListPages:End(),),;
::oWnd := nil ,;
::oDevice:oPreview := nil ,;
::lExit := .T. )
if ::oDevice:lPrvModal
if ::oWndMain == nil
StopUntil( { || ::lExit } )
else
hWndMain := WndMain():hWnd
StopUntil( { || ::lExit .or. !IsWindow( hWndMain ) } )
endif
endif
OnPreviewEnd( Self )
return nil
//----------------------------------------------------------------------------//
function OnPreviewEnd( oPreview )
MsgInfo( "End of Preview" )
return nil
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
PROC pFactura()
local oReport,Pagina:=nLinea := 1
local vTCRCua:=0,vTCRVal:=0
local vTCan:=vTHoj:=vTSub:=vTota:=0
uFec:=dtoc(date())
uTim:=subs(time(),1,8)
SetCustomPrintPreview( { |oDevice,oReport| MyPreview( oDevice, oReport ) } )
EASYREPORT oVRD NAME "C:\xpmake\report\FACTURAC.vrd" PREVIEW (.T.) //OF oDlg2
IF oVRD:lDialogCancel = .T.
RETURN( .F. )
ENDIF
PRINTAREA 1 OF oVRD
PRINTAREA 2 OF oVRD
PRINTAREA 5 OF oVRD
PRINTAREA 6 OF oVRD
END EASYREPORT oVRD
return nil
//----------------------------------------------------------------------------//
function MyPreview( oDevice, oReport )
local oPreview
oPreview := TPreview():New( oDevice, oReport )
oDevice:oPreview := oPreview
//oPreview:Activate()
MyPreviewActivate( oPreview )
return nil
#define GO_POS 0
#define GO_UP 1
#define GO_DOWN 2
#define GO_LEFT 1
#define GO_RIGHT 2
#define GO_PAGE .T.
//----------------------------------------------------------------------------//
function MyPreviewActivate( Self )
local hWndMain
if ::oWnd == nil
return nil
endif
/*
if ::bSetUp != nil
Eval( ::bSetUp, Self, ::oWnd )
endif */
ACTIVATE WINDOW ::oWnd MAXIMIZED ;
ON RESIZE ( ::PaintMeta(), ::ResizeListView() ) ;
ON UP ::VScroll( GO_UP ) ;
ON DOWN ::VScroll( GO_DOWN ) ;
ON PAGEUP ::VScroll( GO_UP, GO_PAGE) ;
ON PAGEDOWN ::VScroll( GO_DOWN, GO_PAGE) ;
ON LEFT ::HScroll( GO_LEFT ) ;
ON RIGHT ::HScroll( GO_RIGHT ) ;
ON PAGELEFT ::HScroll( GO_LEFT, GO_PAGE ) ;
ON PAGERIGHT ::HScroll( GO_RIGHT, GO_PAGE ) ;
VALID ( ::oWnd:oIcon := nil ,;
::oFont:End() ,;
::oCursor:End() ,;
::oMeta1:End() ,;
::oMeta2:End() ,;
::oDevice:End() ,;
::oHand:End() ,;
If( Empty( ::oImageList ),, ( ::oImageList:End(), ::oImageList := nil ) ),;
If( ! Empty( ::oImageListPages ), ::oImageListPages:End(),),;
::oWnd := nil ,;
::oDevice:oPreview := nil ,;
::lExit := .T. )
if ::oDevice:lPrvModal
if ::oWndMain == nil
StopUntil( { || ::lExit } )
else
hWndMain := WndMain():hWnd
StopUntil( { || ::lExit .or. !IsWindow( hWndMain ) } )
endif
endif
OnPreviewEnd( Self )
return nil
//----------------------------------------------------------------------------//
function OnPreviewEnd( oPreview )
MsgInfo( "End of Preview" )
return nil
//----------------------------------------------------------------------------//
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Enrico Maria Giordano, Google [Bot] and 20 guests