Page 1 of 1
Ejecutar Acción al Cerrar el Preview
Posted: Sat Jun 01, 2019 3:36 pm
by leandro
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
Re: Ejecutar Acción al Cerrar el Preview
Posted: Sat Jun 01, 2019 5:59 pm
by jvtecheto
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.
Hola Leandro:
La clase TPreview tiene una data : lExit .T. when the preview window has exited
Saludos.
Jose
Re: Ejecutar Acción al Cerrar el Preview ER
Posted: Sun Jun 02, 2019 1:07 pm
by leandro
Si tienes razon, pero creo que hice la pregunta mal
Lo que pasa es que requiero ejecutar una acción, al momento de cerrar el preview, pero desde Easy Report.
Estuve mirando la clase en el método END, ER llama la función rpreview, la cual se encarga de crear el objeto con la información que viene en la data ::oPrn.
Code: Select all
//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
Pero la funcion rpreview no retorna ninguna variable, y no se como capturar el objeto para luego si poder ejecutar la acción al momento de cerrar el preview.
Code: Select all
//----------------------------------------------------------------------------//
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
Alguien sabe como puedo lograr lo que quiero, de antemano gracias.
Re: Ejecutar Acción al Cerrar el Preview
Posted: Sun Jun 16, 2019 9:42 pm
by nageswaragunupudi
Code: Select all
#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
//----------------------------------------------------------------------------//
Re: Ejecutar Acción al Cerrar el Preview
Posted: Mon Jun 17, 2019 5:38 pm
by leandro
Mr. Nages, Thanks for answering
I will perform some tests and comment.

Re: Ejecutar Acción al Cerrar el Preview
Posted: Mon Jun 17, 2019 5:55 pm
by leandro
Mr Nages
With Easy Report it does not work.
I do not know the syntax for ER.
Code: Select all
//----------------------------------------------------------------------------//
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
//----------------------------------------------------------------------------//