Page 1 of 1

error + mdi + xbrowse (Solucionado)

PostPosted: Sat May 23, 2015 3:40 pm
by leandro
Buenos días...

Lo que pasa es que estoy tratando de usar ventanas mdi con un xbrowse, pero me esta arrojando un error que no he podido corregir, les adjunto el codigo para ver si alguien me puede dar una luz.

La ventana se dibuja bien, pero cuando hago clic sobre el xbrowse, lanza el error.

El codigo de tengo es el siguiente:
Code: Select all  Expand view

FUNCTION vHija()

 LOCAL aCol:={0,0,0},nWidth:=0
 Local cVar := "SELECT * FROM lyma_cobro_serv WHERE ss_manzan=100"
 Private oRsCte, oRsCta, oRsCpto,oWChild

    oRsCte := FW_OPENRECORDSET(oLamcla:oCon,cVar,adLockOptimistic,adOpenKeyset)

    DEFINE FONT oFontCli NAME "TAHOMA" SIZE 0, -13

    DEFINE WINDOW oWChild MDICHILD NOSYSMENU;
              TITLE "Ordenes de Corte" OF oWnd

              SET FONT OF oWChild TO oFontCli
              SET MESSAGE OF oWChild TO "ordenes de corte "

    DEFINE BUTTONBAR oBar1 OF oWChild SIZE 80, 60 2007

    DEFINE BUTTON OF oBar1 ACTION oWChild:End() ;
              RESOURCE "Salir" PROMPT "Salir" TOOLTIP "Salir de esta pantalla"


   oBrw := TXBrowse():New( oWChild )
   oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLROW
   oBrw:nColDividerStyle    := LINESTYLE_LIGHTGRAY
   oBrw:nHeaderLines        := 1
   oBrw:lColDividerComplete := .t.
   oBrw:lRecordSelector     := .t.
   oBrw:bClrSel            := {|| { CLR_BLACK,oLamcla:cClr7 } }
   oBrw:bClrStd            := {|| IF( (oRsCte:AbsolutePosition()%2)==0,{pReColLet(oRsCte:Fields( "ss_contro" ):Value),oLamcla:cClr2},{pReColLet(oRsCte:Fields( "ss_contro" ):Value),oLamcla:cClr1} ) }
   oBrw:bClrSelFocus        := {|| { CLR_WHITE,oLamcla:cClr8 } }
   oBrw:l2007          := .T.
   oBrw:nStretchCol         := STRETCHCOL_LAST


   aCol[ 1]                   := oBrw:AddCol()
   aCol[ 1]:bStrData          := { || If( oRsCte:Eof, Space( nWidth ), cValtoChar( oRsCte:Fields( "ss_docume" ):Value ) ) }
   aCol[ 1]:cHeader            := "Consec"
   aCol[ 1]:nHeadStrAlign     := AL_LEFT
   aCol[ 1]:nDataStrAlign     := AL_LEFT
   aCol[ 1]:nWidth            := 50

   aCol[ 2]                   := oBrw:AddCol()
   aCol[ 2]:bStrData          := { || If( oRsCte:Eof, Space( nWidth ), cValtoChar( oRsCte:Fields( "ss_period" ):Value ) ) }
   aCol[ 2]:cHeader            := "Periodo"
   aCol[ 2]:nHeadStrAlign     := AL_LEFT
   aCol[ 2]:nDataStrAlign     := AL_LEFT
   aCol[ 2]:nWidth            := 50


   oBrw:SetADO( oRsCte )
   oBrw:CreateFromCode( )

   oWChild:oClient := oBrw


    ACTIVATE WINDOW oWChild MAXIMIZED VALID(oRsCte:close(),.t. )
    SysRefresh()
    RELEASE FONT oFontCli
return( nil )
 


El error
Code: Select all  Expand view
Application
===========
   Path and name: C:\Cartera\Cartera.Exe (32 bits)
   Size: 1,566,208 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
   FiveWin  Version: FWHX 15.01
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 13 secs
   Error occurred at: 05/23/15, 10:36:33
   Error description: Error ADODB.RecordSet/6  DISP_E_UNKNOWNNAME: RECORDCOUNT
   Args:

Stack Calls
===========
   Called from:  => TOLEAUTO:RECORDCOUNT( 0 )
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:SETADO( 4560 )
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE( 436 )
   Called from:  => TXBROWSE:KEYCOUNT( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:REFRESH( 1274 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:MOUSELEAVE( 3557 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 12605 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3450 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 286 )
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 420 )
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 23 )
   Called from:  => TOLEAUTO:RECORDCOUNT( 0 )
   Called from: .\source\classes\XBROWSE.PRG => ADOSKIP( 8422 )
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:SETADO( 4560 )
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE( 442 )
   Called from:  => TXBROWSE:SKIP( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 1516 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 1368 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1699 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 12607 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3450 )
   Called from:  => DIALOGBOXINDIRECT( 0 )
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 286 )
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 420 )
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 23 )
   Called from: C:\Cartera\Prg\r32_rin4.prg => (b)VHIJA( 468 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 10376 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA( 10283 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DRAWLINE( 1852 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:LBUTTONDOWN( 3406 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1720 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 12607 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3450 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1152 )
   Called from: C:\Cartera\Prg\r32_menu.prg => MAIN( 227 )
 

Re: error + mdi + xbrowse

PostPosted: Sat May 23, 2015 4:07 pm
by Ariel
Hola,
proba de incluir #include "ado.ch"
es como que no encuentra la funcion reccount()
Salu2, Ariel.

Re: error + mdi + xbrowse

PostPosted: Sat May 23, 2015 6:46 pm
by leandro
Buenas tardes....

Les comento que detecte que el error sale cuando maximizo la ventana y la cierro... o cuando la ventana esta maximizada y cierro la aplicación... sin cerrar primero la ventana mdi.

Como Cierro las ventanas mdi... antes de cerrar la aplicación?

Debo hacer algo antes de cerrar mi aplicación?

Saludos

Code: Select all  Expand view
Application
===========
   Path and name: C:\Cartera\Cartera.Exe (32 bits)
   Size: 1,576,448 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
   FiveWin  Version: FWHX 15.01
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 12 secs
   Error occurred at: 05/23/15, 13:50:47
   Error description: Error ADODB.RecordSet/6  DISP_E_UNKNOWNNAME: CLOSE
   Args:

Stack Calls
===========
   Called from:  => TOLEAUTO:CLOSE( 0 )
   Called from: C:\Cartera\Prg\r32_rin4.prg => (b)VHIJA( 520 )
   Called from: .\source\classes\MDICHILD.PRG => TMDICHILD:END( 276 )
   Called from: .\source\classes\MDICLIEN.PRG => TMDICLIENT:LCLOSEALL( 204 )
   Called from: .\source\classes\MDIFRAME.PRG => TMDIFRAME:END( 270 )
   Called from: C:\Cartera\Prg\r32_menu.prg => (b)MAIN( 198 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:CLICK( 715 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:LBUTTONUP( 924 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1723 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:HANDLEEVENT( 1597 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3450 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1152 )
   Called from: C:\Cartera\Prg\r32_menu.prg => MAIN( 227 )

Re: error + mdi + xbrowse

PostPosted: Sat May 23, 2015 10:42 pm
by horacio
Leandro, yo uso ventanas MDI y no necesitas cerrar las ventanas hijas para salir de la aplicación. Para cerrar todas las ventanas hijas "oWndMain : CloseAll()".

Saludos

Re: error + mdi + xbrowse

PostPosted: Sun May 24, 2015 7:46 am
by Antonio Linares
Leandro,

Prueba a cambiar:

Private oRsCte

por static oRsCte

Como la ventana mdichild no detiene la ejecución de la aplicación, esa función continúa y al salir entiendo
que destruye el valor de la variable private

Re: error + mdi + xbrowse

PostPosted: Sun May 24, 2015 2:08 pm
by leandro
Buenos dias a todos....

Antonio, ya lo habia intentado de esa manera pero no me funciono.

Lo solucione cerrando las ventanas hijas antes de cerrar la aplicación.

Code: Select all  Expand view
    @ 15, 10 ADD BUTTON oBtn1 GROUP oGr5 BITMAP "#8013" ;
           SIZE 54,52 PROMPT "Salir" action( oWnd:closeall(),oWnd:End())
 


El error sale debido a que creo la conexión con la base de datos al inicio de la aplicación y la cierro al momento de finalizar la ventana principal.


Horacio muchas gracias.

Re: error + mdi + xbrowse

PostPosted: Sun May 24, 2015 2:44 pm
by leandro
Buenos días que pena seguir molestando...

Lo que pasa es que cuando tengo abiertas varias ventanas hijas, y cierro una de ellas me esta arrojando el siguiente error.

Code: Select all  Expand view

Application
===========
   Path and name: C:\Cartera\Cartera.Exe (32 bits)
   Size: 1,580,032 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20140725)
   FiveWin  Version: FWHX 15.01
   Windows version: 6.2, Build 9200

   Time from start: 0 hours 0 mins 14 secs
   Error occurred at: 24/05/2015, 09:38:59
   Error description: Error ADODB.RecordSet/6  DISP_E_UNKNOWNNAME: RECORDCOUNT
   Args:
 


Me di cuenta es que por que en el valid de la ventana cierro lo recorset de la siguiente manera:
Code: Select all  Expand view

   ACTIVATE WINDOW oWHiCt  MAXIMIZED ON RESIZE( oExpBCtra:AdjLeft(), oSplitV:AdjClient(), oSplitV:AdjRight() ) VALID(oRsDocfac:close(),oBtn16:enable(),.t. )
 


Solo con quitarlo dejaron d salir lo errores al finalizar la ventana hija.

Las preguntas son? Esos recorset quedan en memoria? Fw se encarga de ellos y los cierra automáticamente? o al finalizar la aplicación se cierran? o en donde los puedo cerrar para q no me arroje el error?

Saludos

Re: error + mdi + xbrowse

PostPosted: Sun May 24, 2015 10:16 pm
by Antonio Linares
Leandro,

Prueba asi:

ACTIVATE WINDOW oWHiCt MAXIMIZED ON RESIZE( oExpBCtra:AdjLeft(), oSplitV:AdjClient(), oSplitV:AdjRight() ) ;
VALID( oBrw:End(), oRsDocfac:close(),oBtn16:enable(),.t. )

Re: error + mdi + xbrowse

PostPosted: Sun May 24, 2015 11:47 pm
by nageswaragunupudi
When using MDI ChildWindow, closing data, release of fonts/resources, etc should be done in oWndChild:bPostEnd, but NOT in VALID clause or after activate command

Please replace
Code: Select all  Expand view

   oWChild:oClient := oBrw


    ACTIVATE WINDOW oWChild MAXIMIZED VALID(oRsCte:close(),.t. )
    SysRefresh()
    RELEASE FONT oFontCli
 


with this code
Code: Select all  Expand view

    oWChild:oClient := oBrw
    oWChild:bPostEnd := { || oRsCte:Close(), oFontCli:End() }

    ACTIVATE WINDOW oWChild MAXIMIZED
 

Re: error + mdi + xbrowse

PostPosted: Wed May 27, 2015 4:23 pm
by leandro
Ok voy a hacer las pruebas

Luego comento los resultados.

Re: error + mdi + xbrowse

PostPosted: Tue Jun 16, 2015 6:16 pm
by leandro
Mr Rao.

Muchas Gracias.... Era la solucion. :D