Page 1 of 1

error close DIALOG

Posted: Sun Oct 25, 2009 12:59 pm
by Dorneles
When I close the DIALOG without closing the WINDOWS of an error, how to get you close to the DIALOG Program also close, or not happen the error.

Code: Select all

#INCLUDE "FIVEWIN.CH"

FUNCTION MAIN()

   LOCAL oDlg

   DEFINE DIALOG oDlg                                       ;
      FROM 1, 1 TO 10, 30


   ACTIVATE DIALOG oDlg CENTERED ON INIT(PortalNFe())

RETURN NIL

/////////////////////////////////////////////////////////////////////////////// 
FUNCTION PortalNFe()
///////////////////////////////////////////////////////////////////////////////   

   Local oActiveX,oWndNfe

    DEFINE WINDOW oWndNfe FROM 3, 2 TO 26, 98 TITLE "Portal Nacional da Nota Fiscal Eletrônica" //OF oWnd//of ofld
    
    oActiveX = TActiveX():New( oWndNfe, "Shell.Explorer" )

   oWndNfe:oClient = oActiveX 

   oActiveX:Do( "Navigate", "https://www.nfe.fazenda.gov.br/portal/FormularioDePesquisa.aspx?tipoconsulta=completa" )
   ACTIVATE WINDOW oWndNfe
   
   EndDialog()
       
RETURN nil
/////////////////////////////////////////////////////////////////////////////// 
 

Re: error close DIALOG

Posted: Mon Oct 26, 2009 3:59 am
by James Bott

Code: Select all

ACTIVATE WINDOW oWndNfe
   
EndDialog()
Remember that windows are non-modal so the EndDialog is called as soon as the window is activated, which is not what you wanted.

Try this:

ACTIVATE WINDOW oWndNfe valid EndDialog()

This way EndDialog() is only called when the user closes the window.


Regards,
James