error close DIALOG

Post Reply
Dorneles
Posts: 30
Joined: Mon Oct 30, 2006 2:39 pm
Location: Brasil

error close DIALOG

Post 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
/////////////////////////////////////////////////////////////////////////////// 
 
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: error close DIALOG

Post 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
Post Reply