Ejecutar Acción al Cerrar el Preview

Ejecutar Acción al Cerrar el Preview

Postby leandro » Sat Jun 01, 2019 3:36 pm

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
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1620
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Ejecutar Acción al Cerrar el Preview

Postby jvtecheto » Sat Jun 01, 2019 5:59 pm

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
Fwh 19.06 32 bits + Harbour 3.2dev(r2104281802) + Borland 7.4 + FivEdit
User avatar
jvtecheto
 
Posts: 584
Joined: Mon Mar 04, 2013 4:32 pm
Location: Spain

Re: Ejecutar Acción al Cerrar el Preview ER

Postby leandro » Sun Jun 02, 2019 1:07 pm

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  Expand view

      //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  Expand view

//----------------------------------------------------------------------------//

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.
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1620
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Ejecutar Acción al Cerrar el Preview

Postby nageswaragunupudi » Sun Jun 16, 2019 9:42 pm

Code: Select all  Expand view
#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

//----------------------------------------------------------------------------//


 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10465
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Ejecutar Acción al Cerrar el Preview

Postby leandro » Mon Jun 17, 2019 5:38 pm

Mr. Nages, Thanks for answering

I will perform some tests and comment. :D
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1620
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: Ejecutar Acción al Cerrar el Preview

Postby leandro » Mon Jun 17, 2019 5:55 pm

Mr Nages

With Easy Report it does not work.

I do not know the syntax for ER.

Code: Select all  Expand view

//----------------------------------------------------------------------------//

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

//----------------------------------------------------------------------------//

 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1620
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 20 guests