FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Ejecutar Acci贸n al Cerrar el Preview
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Ejecutar Acci贸n al Cerrar el Preview
Posted: Sat Jun 01, 2019 03: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

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 607
Joined: Mon Mar 04, 2013 04:32 PM
Re: Ejecutar Acci贸n al Cerrar el Preview
Posted: Sat Jun 01, 2019 05: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 24.07 64 bits + Harbour 64 bits 3.2dev(r2407221137) + MSVC64
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: Ejecutar Acci贸n al Cerrar el Preview ER
Posted: Sun Jun 02, 2019 01: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 (fw): Select all Collapse
聽 聽 聽 //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()
聽 聽 聽 聽 聽//::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 (fw): Select all Collapse
//----------------------------------------------------------------------------//

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

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Ejecutar Acci贸n al Cerrar el Preview
Posted: Sun Jun 16, 2019 09:42 PM
Code (fw): Select all Collapse
#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
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: Ejecutar Acci贸n al Cerrar el Preview
Posted: Mon Jun 17, 2019 05: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

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]
Posts: 1816
Joined: Wed Oct 26, 2005 02:49 PM
Re: Ejecutar Acci贸n al Cerrar el Preview
Posted: Mon Jun 17, 2019 05:55 PM
Mr Nages

With Easy Report it does not work.

I do not know the syntax for ER.

Code (fw): Select all Collapse
//----------------------------------------------------------------------------//

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

[ Turbo Incremental Link64 6.98 Embarcadero 7.70 ] [ FiveWin 25.01 ] [ xHarbour 64 bits) ]

Continue the discussion