error interno FWH

Re: error interno FWH

Postby Antonio Linares » Tue Feb 12, 2013 9:24 am

carlos vargas wrote:me parece que ::oWnd : NIL debe se la ultima linea antes del true final.
::oImageList es un objeto que por lo general esta asociado a un hWnd, y pienso en este caso que debe estar usando el oWnd:hWnd , y al ser oWnd ya nil, puede reventar.

Code: Select all  Expand view

      VALID        ( ::oWnd:oIcon := nil       ,;
                     ::oFont:End()             ,;
                     ::oMeta1:End()            ,;
                     ::oMeta2:End()            ,;
                     ::oDevice:End()           ,;
                     ::oHand:End()             ,;
                     If( Empty( ::oImageList ),, (::oImageList:End(), ::oImageList := nil ) ),;
                     ::oWnd := nil             ,;
                     ::lExit := .t.            ,;
 


salu2


Carlos,

buena sugerencia, incluida para el próximo build, gracias! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41321
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error interno FWH

Postby elvira » Tue Feb 12, 2013 9:34 am

Antonio,

¿Y cómo puedo saber cuándo el informe se está mostrando?.

Por ejemplo, en samples\report.prg

Code: Select all  Expand view
// Testing FiveWin built-in report engine and print preview

#include "FiveWin.ch"
#include "Report.ch"

static oWnd

function Main()

   local oBar, oCursorHand

   DEFINE WINDOW oWnd ;
      TITLE "Testing FiveWin Report-Engine and Print-Preview" ;
      MENU  BuildMenu()

   DEFINE BUTTONBAR oBar _3D SIZE 26, 27 OF oWnd

   DEFINE BUTTON OF oBar FLAT TOOLTIP "Generate report" ;
      ACTION DoReport() RESOURCE "Report"

   DEFINE BUTTON OF oBar FLAT GROUP TOOLTIP "Exit" ;
      ACTION oWnd:End() RESOURCE "Exit"

   DEFINE CURSOR oCursorHand HAND

   AEval( oBar:aControls, { | o | o:oCursor := oCursorHand } )

   DEFINE MESSAGE BAR OF oWnd TITLE FWCOPYRIGHT ;
      NOINSET DATE CLOCK KEYBOARD

   ACTIVATE WINDOW oWnd ;
      VALID MsgYesNo( "Want to exit ?" )

return nil

function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "&Generate Report" ACTION DoReport() ;
         MESSAGE "Open customers database and generate a report"

      MENUITEM "&Exit" ACTION oWnd:End() ;
         MESSAGE "Terminate the application and exit"
   ENDMENU

return oMenu

function DoReport()

   local oRpt

   USE Customer

   REPORT oRpt PREVIEW
      COLUMN TITLE "First" DATA Customer->First
      COLUMN TITLE "Last"  DATA Customer->Last
      COLUMN TITLE "State" DATA Customer->State
   END REPORT

   ACTIVATE REPORT oRpt

   USE

return nil



En este sample, si cierro la WndMain con el Preview abierto casca.

¿Tu cambio arreglaría esto?.

Gracias.
elvira
 
Posts: 515
Joined: Fri Jun 29, 2012 12:49 pm

Re: error interno FWH

Postby Antonio Linares » Tue Feb 12, 2013 10:16 am

Esta, por ejemplo, sería una forma:

Code: Select all  Expand view
// Testing FiveWin built-in report engine and print preview

#include "FiveWin.ch"
#include "Report.ch"

static oWnd, lPreview := .F.

function Main()

   local oBar, oCursorHand

   DEFINE WINDOW oWnd ;
      TITLE "Testing FiveWin Report-Engine and Print-Preview" ;
      MENU  BuildMenu()

   DEFINE BUTTONBAR oBar _3D SIZE 26, 27 OF oWnd

   DEFINE BUTTON OF oBar FLAT TOOLTIP "Generate report" ;
      ACTION DoReport() RESOURCE "Report"

   DEFINE BUTTON OF oBar FLAT GROUP TOOLTIP "Exit" ;
      ACTION oWnd:End() RESOURCE "Exit"

   DEFINE CURSOR oCursorHand HAND

   AEval( oBar:aControls, { | o | o:oCursor := oCursorHand } )

   DEFINE MESSAGE BAR OF oWnd TITLE FWCOPYRIGHT ;
      NOINSET DATE CLOCK KEYBOARD

   ACTIVATE WINDOW oWnd ;
      VALID ! lPreview .and. MsgYesNo( "Want to exit ?" )

return nil

function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "&Generate Report" ACTION DoReport() ;
         MESSAGE "Open customers database and generate a report"

      MENUITEM "&Exit" ACTION oWnd:End() ;
         MESSAGE "Terminate the application and exit"
   ENDMENU

return oMenu

function DoReport()

   local oRpt

   lPreview = .T.

   USE Customer

   REPORT oRpt PREVIEW
      COLUMN TITLE "First" DATA Customer->First
      COLUMN TITLE "Last"  DATA Customer->Last
      COLUMN TITLE "State" DATA Customer->State
   END REPORT

   ACTIVATE REPORT oRpt

   USE

   lPreview = .F.

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41321
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error interno FWH

Postby elvira » Tue Feb 12, 2013 10:19 am

Antonio,

¿Y no podría modificarse rpreview.prg para que si desaparece oWIndMain se cierre el Preview sin dar el error?.

Error BASE/1004 Message not found: NIL:HWND


Gracias.
elvira
 
Posts: 515
Joined: Fri Jun 29, 2012 12:49 pm

Re: error interno FWH

Postby Antonio Linares » Tue Feb 12, 2013 10:32 am

Podriamos modificar de forma automática el VALID de la ventana principal, pero imagino que esto puede resultar un problema para ciertas aplicaciones que hagan determinadas cosas en el VALID de la ventana principal.

Vamos a pensarlo y ver si es algo simple o puede complicarse...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41321
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error interno FWH

Postby elvira » Tue Feb 12, 2013 11:54 am

Antonio,

En Facturaplus lo que hacen es al lanzar el Preview ocultar la ventana principal y cuando se sale volver a mostrarla.

Creo que es muy buena idea.

Cualquier programa hecho con FWH siempre casca cerrando la ventana principal cuando está abierto el preview, por ejemplo el GST Rotor de Apolosoftware.

Un saludo
elvira
 
Posts: 515
Joined: Fri Jun 29, 2012 12:49 pm

Re: error interno FWH

Postby Antonio Linares » Tue Feb 12, 2013 12:34 pm

Es otra opción, puedes hacerlo asi:

oWnd:Hide()
ejecutas el preview
oWnd:Show()
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41321
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error interno FWH

Postby elvira » Tue Feb 12, 2013 1:00 pm

Antonio,

En rpreview.prg de hecho ya lo tenías antes en parte:

if oDevice:lPrvModal .and. oWndMain != nil
oWndMain:Hide()


Si hago lo de Hide and Show ya no hay forma de que pueda cascar.

Muchas gracias.


Un saludo
elvira
 
Posts: 515
Joined: Fri Jun 29, 2012 12:49 pm

Re: error interno FWH

Postby Antonio Linares » Tue Feb 12, 2013 2:08 pm

Si, de hecho es para cuando se usa el PREVIEW en modo MODAL:

PRINT oPrn PREVIEW MODAL

si no se especifica se entiende que se quiere que se pueda acceder a todas las ventanas abiertas de la aplicación
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41321
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: error interno FWH

Postby Joaquim Ferrer » Fri Feb 22, 2013 11:20 am

elvira wrote:Antonio,

En rpreview.prg de hecho ya lo tenías antes en parte:

if oDevice:lPrvModal .and. oWndMain != nil
oWndMain:Hide()


Si hago lo de Hide and Show ya no hay forma de que pueda cascar.

Muchas gracias.


Un saludo


El problema si lo ocultas con Hide(), queda oculta la ventana principal de la aplicacion, hay que volver a mostrarla.
Tengo estas modificaciones a rpreview por si sirven.
Activate queda así :
Code: Select all  Expand view
METHOD Activate() CLASS TPreview

   ::oWnd:bInit := {|| ::Zoom() }   // Add by Quim, a gusto del consumidor, muchos preview hay que hacer click para ver datos, asi se evita que el usuario tenga que hacerlo.

   ACTIVATE WINDOW ::oWnd MAXIMIZED ;
      ON RESIZE    ::PaintMeta()                  ;
      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()             ,;
                     ::oMeta1:End()            ,;
                     ::oMeta2:End()            ,;
                     ::oDevice:End()           ,;
                     ::oHand:End()             ,;
                     If( Empty( ::oImageList ),, (::oImageList:End(), ::oImageList := nil ) ),;
                     ::oWnd  := nil            ,;
                     ::lExit := .t.            ,;
                     If( ::oWndMain != NIL, ::oWndMain:Show(), ), ;  // Ad by Quim
                     .t. )
 


BuildWindow queda asi :
Code: Select all  Expand view

METHOD BuildWindow() CLASS TPreview

   local oIcon, cTitle := "FiveWin Printing Preview", oCursor, oBar, nCol := 325
   local oThis := Self

   DEFAULT ::oWndMain := WndMain()

   ::hOldRes := GetResources()

   #ifdef __CLIPPER__
      ::cResFile := "Preview.dll"
   #else
      if ! IsWin64()
         ::cResFile := "Prev32.dll"
      else
         ::cResFile = "Prev64.dll"
      endif
   #endif

   if SetResources( ::cResFile ) < 32
      MsgStop( ::cResFile + " not found, imposible to continue",;
               "FiveWin Printing Error" )
      return nil
   endif
   ::hNewRes      := GetResources()

   if ::oDevice != nil
      cTitle = ::oDevice:cDocument
   endif

   if ::oWndMain != nil
      oIcon = ::oWndMain:oIcon
   else
      DEFINE ICON oIcon RESOURCE "Print"
   endif

   if ::oDevice:lPrvModal .and. ::oWndMain != NIL   // Add by Quim. En versiones antiguas ya estaba, simplemente lo rescato y renombro variables locales por variables de clase.
      ::oWndMain:Hide()
   endif
 


Saludos
Fivewinner desde 1.9, programador PHP y Javascript, PWA & HTML5 evangelista
User avatar
Joaquim Ferrer
 
Posts: 105
Joined: Sat Jan 14, 2012 3:46 pm
Location: Barcelona

Previous

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 10 guests